Skip to content

Commit

Permalink
Merge branch 'manawiki:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
xHomu authored Aug 27, 2024
2 parents a11170a + e0bd68d commit 939d430
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/_custom/hooks/search-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ export const afterChangeSearchSyncHook: CollectionAfterChangeHook = async ({

//Due to the way Payload handles depth in relationships, we need to fetch the icon URL if it exists
const { url: iconUrl } = doc?.icon?.url
? doc?.icon
? { url: doc?.icon?.url }
: doc?.icon
? await payload.findByID({
collection: "images",
id: doc?.icon,
depth: 0,
})
: null;
: { url: null };

await typesensePrivateClient
.collections("entries")
Expand Down
11 changes: 10 additions & 1 deletion app/db/collections/collections/collections-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ export const collectionsAfterChangeHook: CollectionAfterChangeHook = async ({
doc?.site?.domain ? doc?.site?.domain : `${doc?.site?.slug}.mana.wiki`
}${collectionRelativeURL}`;

const iconUrl = doc?.icon?.url;
//Due to the way Payload handles depth in relationships, we need to fetch the icon URL if it exists
const { url: iconUrl } = doc?.icon?.url
? { url: doc?.icon?.url }
: doc?.icon
? await payload.findByID({
collection: "images",
id: doc?.icon,
depth: 0,
})
: { url: null };

await typesensePrivateClient
.collections("collections")
Expand Down
10 changes: 9 additions & 1 deletion app/db/collections/custom-pages/custom-pages-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ export const customPagesAfterChangeHook: CollectionAfterChangeHook = async ({

const description = doc?.description;

const iconUrl = doc?.icon?.url;
const { url: iconUrl } = doc?.icon?.url
? { url: doc?.icon?.url }
: doc?.icon
? await payload.findByID({
collection: "images",
id: doc?.icon,
depth: 0,
})
: { url: null };

await typesensePrivateClient
.collections("customPages")
Expand Down
11 changes: 10 additions & 1 deletion app/db/collections/entries/entries-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ export const entriesAfterChangeHook: CollectionAfterChangeHook = async ({
doc?.site?.domain ? doc?.site?.domain : `${doc?.site?.slug}.mana.wiki`
}${entryRelativeURL}`;

const iconUrl = doc?.icon?.url;
const { url: iconUrl } = doc?.icon?.url
? { url: doc?.icon?.url }
: doc?.icon
? await payload.findByID({
collection: "images",
id: doc?.icon,
depth: 0,
})
: { url: null };

const description = doc?.collectionEntity?.name;

await typesensePrivateClient
Expand Down
11 changes: 10 additions & 1 deletion app/db/collections/posts/posts-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ export const postsAfterChangeHook: CollectionAfterChangeHook = async ({
: `${doc?.site?.slug}.mana.wiki`
}${postRelativeURL}`;

const bannerUrl = doc?.banner?.url;
//Due to the way Payload handles depth in relationships, we need to fetch the icon URL if it exists
const { url: bannerUrl } = doc?.banner?.url
? { url: doc?.banner?.url }
: doc?.banner
? await payload.findByID({
collection: "images",
id: doc?.banner,
depth: 0,
})
: { url: null };
const description = doc?.subtitle;

await typesensePrivateClient
Expand Down
4 changes: 3 additions & 1 deletion app/db/collections/users/users.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const Users: CollectionConfig = {
}/verify?token=${token}`;

return `
<span>Hey ${user.email}, thanks for registering at Mana.</span>
<span>Hey ${user.email}, thanks for registering at ${
process.env.HOST_DOMAIN ?? "mana.wiki"
}</span>
<br><br>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_site+/_components/Column-2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function ColumnTwo({
<section className="bg-2 border-color shadow-1 z-50 border-r laptop:shadow-sm laptop:shadow-1">
<div
className="fixed bottom-0 flex flex-col top-0 z-50 mx-auto h-full overflow-y-auto shadow-sm
max-laptop:hidden laptop:w-[60px] desktop:w-[229px] pb-28
max-laptop:hidden laptop:w-[60px] desktop:w-[229px] laptop:pb-72
dark:scrollbar-thumb-dark500 dark:scrollbar-track-bg2Dark
scrollbar-thumb-zinc-200 scrollbar-track-zinc-50 scrollbar"
>
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_site+/_components/Column-4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function ColumnFour() {
{groupedTrendingPages.length > 0 ? (
<>
<TabGroup
className="flex-grow overflow-auto max-h-[670px] z-20 dark:bg-dark350 scrollbar
className="flex-grow overflow-auto max-h-[672px] z-20 scrollbar
dark:scrollbar-thumb-zinc-500 dark:scrollbar-track-dark450
scrollbar-thumb-zinc-300 scrollbar-track-zinc-100"
>
Expand Down
2 changes: 2 additions & 0 deletions app/routes/_site+/_components/RampInit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export function RampInit({ adWebId }: { adWebId?: string | null | undefined }) {
if (slotsToRemove && slotsToRemove.length > 0) {
//@ts-ignore
window.ramp.destroyUnits(slotsToRemove).then(addUnits);
//@ts-ignore
window.PageOS.session.newPageView();
}
};

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_site+/privacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function PolicyTemplate({
domain: string;
}) {
return (
<div className="relative z-20 mx-auto pt-24 laptop:pt-8 max-w-[680px] max-laptop:px-4">
<div className="relative z-20 mx-auto pt-24 laptop:pt-8 max-w-[728px] max-laptop:px-4">
<h1 className="pb-4 font-header text-xl font-bold">Privacy policy</h1>
<div className="pb-10">
<Text className="pb-4">
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_user+/components/UserMenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function UserMenuItems() {
<div className="space-y-1.5 flex-grow">
<UserMenuLink text="Account" icon="user" to="/user/account" />
<UserMenuLink text="Appearance" icon="palette" to="/user/appearance" />
<UserMenuLink text="Billing" icon="credit-card" to="/user/billing" />
{/* <UserMenuLink text="Billing" icon="credit-card" to="/user/billing" /> */}
</div>
);
}
3 changes: 3 additions & 0 deletions core.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ async function startCore() {
const getHost = (req: { get: (key: string) => string | undefined }) =>
req.get("X-Forwarded-Host") ?? req.get("host") ?? "";

// fly is our proxy
app.set("trust proxy", true);

app.use((req, res, next) => {
//enforce https connection to make sure the site uses http2 protocol
const proto = req.get("X-Forwarded-Proto");
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"clean": "shx rm -rf node_modules dist build public/build",
"seed:core": "cross-env PAYLOAD_CONFIG_PATH=./app/db/payload.config.ts ts-node -T app/_custom/seed/index.ts",
"seed:custom": "cross-env PAYLOAD_CONFIG_PATH=./app/db/payload.custom.config.ts ts-node -T app/_custom/seed/index.ts",
"resave": "cross-env PAYLOAD_CONFIG_PATH=./app/db/payload.custom.config.ts ts-node -T ./scripts/resaveCollection",
"resaveCore": "cross-env PAYLOAD_CONFIG_PATH=./app/db/payload.config.ts ts-node -T ./scripts/resaveCollection",
"resaveCustom": "cross-env PAYLOAD_CONFIG_PATH=./app/db/payload.custom.config.ts ts-node -T ./scripts/resaveCollection",
"typesense": "cross-env ts-node -T ./scripts/typesenseActions",
"postinstall": "patch-package"
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/resaveCollection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Payload from "payload";

import { manaSlug } from "../app/utils/url-slug";
// import { manaSlug } from "../app/utils/url-slug";

require("dotenv").config();

Expand Down Expand Up @@ -41,7 +41,7 @@ const resaveCollection = async () => {
await payload.update({
collection: collectionSlug,
id,
depth: 0,
depth: 2,
data: {
updatedAt: new Date(),
// slug: manaSlug(result.name),
Expand Down

0 comments on commit 939d430

Please sign in to comment.