diff --git a/README.md b/README.md index 91a2c8809..55f599235 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ psql postgres -c "create database calckey with encoding = 'UTF8';" - To add custom CSS for all users, edit `./custom/assets/instance.css`. - To add static assets (such as images for the splash screen), place them in the `./custom/assets/` directory. They'll then be available on `https://yourinstance.tld/static-assets/filename.ext`. - To add custom locales, place them in the `./custom/locales/` directory. If you name your custom locale the same as an existing locale, it will overwrite it. If you give it a unique name, it will be added to the list. Also make sure that the first part of the filename matches the locale you're basing it on. (Example: `en-FOO.yml`) +- To add custom error images, place them in the `./custom/assets/badges` directory, replacing the files already there. +- To add custom sounds, place only mp3 files in the `./custom/assets/sounds` directory. - To update custom assets without rebuilding, just run `pnpm run gulp`. ## 🧑‍🔬 Configuring a new instance diff --git a/custom/assets/badges/error.png b/custom/assets/badges/error.png new file mode 100644 index 000000000..b2fd48b23 --- /dev/null +++ b/custom/assets/badges/error.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:227326c64cce0cd93b18b0065c97bc4887b1a895f377382a32c3058c5375abd0 +size 58350 diff --git a/custom/assets/badges/info.png b/custom/assets/badges/info.png new file mode 100644 index 000000000..10b1ef217 --- /dev/null +++ b/custom/assets/badges/info.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7a4f2460b5ccbee9fab5bb93bc312125efd0eb1cd82cd56e5ecf0b4fc5d8ef7 +size 56191 diff --git a/custom/assets/badges/not-found.png b/custom/assets/badges/not-found.png new file mode 100644 index 000000000..eaf62f9e3 --- /dev/null +++ b/custom/assets/badges/not-found.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb357df23841d87e0cda813bcaffe6152929c71703f8250206819fb0ed8ef1d8 +size 56874 diff --git a/packages/backend/assets/sounds/None.mp3 b/custom/assets/sounds/None.mp3 similarity index 100% rename from packages/backend/assets/sounds/None.mp3 rename to custom/assets/sounds/None.mp3 diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index e643e24c9..10ab5c66f 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -128,20 +128,21 @@ export async function createNote( // Skip if note is made before 2007 (1yr before Fedi was created) // OR skip if note is made 3 days in advance if (note.published) { - const DateChecker = new Date(note.published) - const FutureCheck = new Date() - FutureCheck.setDate(FutureCheck.getDate() + 3) // Allow some wiggle room for misconfigured hosts + const DateChecker = new Date(note.published); + const FutureCheck = new Date(); + FutureCheck.setDate(FutureCheck.getDate() + 3); // Allow some wiggle room for misconfigured hosts if (DateChecker.getFullYear() < 2007) { - logger.warn('Note somehow made before Activitypub was created; discarding'); + logger.warn( + "Note somehow made before Activitypub was created; discarding", + ); return null; } if (DateChecker > FutureCheck) { - logger.warn('Note somehow made after today; discarding') + logger.warn("Note somehow made after today; discarding"); return null; } } - // Fetch author const actor = (await resolvePerson( getOneApId(note.attributedTo), diff --git a/packages/backend/src/server/api/endpoints.ts b/packages/backend/src/server/api/endpoints.ts index 35ab738a2..7fb5fd320 100644 --- a/packages/backend/src/server/api/endpoints.ts +++ b/packages/backend/src/server/api/endpoints.ts @@ -669,7 +669,7 @@ const eps = [ ["users/stats", ep___users_stats], ["admin/drive-capacity-override", ep___admin_driveCapOverride], ["fetch-rss", ep___fetchRss], - ["get-sounds", ep___sounds] + ["get-sounds", ep___sounds], ]; export interface IEndpointMeta { diff --git a/packages/backend/src/server/api/endpoints/get-sounds.ts b/packages/backend/src/server/api/endpoints/get-sounds.ts index aa3ef24e7..f7edd3860 100644 --- a/packages/backend/src/server/api/endpoints/get-sounds.ts +++ b/packages/backend/src/server/api/endpoints/get-sounds.ts @@ -14,15 +14,17 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const music_files: (string|null)[] = [null, ]; - const directory = (await readdir('./assets/sounds', { withFileTypes: true })) - .filter(potentialFolder => potentialFolder.isDirectory()) + const music_files: (string | null)[] = [null]; + const directory = ( + await readdir("./assets/sounds", { withFileTypes: true }) + ).filter((potentialFolder) => potentialFolder.isDirectory()); for await (const folder of directory) { - const files = (await readdir(`./assets/sounds/${folder.name}`)) - .filter(potentialSong => potentialSong.endsWith('.mp3')) + const files = (await readdir(`./assets/sounds/${folder.name}`)).filter( + (potentialSong) => potentialSong.endsWith(".mp3"), + ); for await (const file of files) { - music_files.push(`${folder.name}/${file.replace('.mp3','')}`); + music_files.push(`${folder.name}/${file.replace(".mp3", "")}`); } } - return music_files + return music_files; }); diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index 189705903..6d02ad0ab 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -61,10 +61,12 @@ router.use( }), ); -mastoRouter.use(koaBody({ - multipart: true, - urlencoded: true -})); +mastoRouter.use( + koaBody({ + multipart: true, + urlencoded: true, + }), +); apiMastodonCompatible(mastoRouter); diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index cd495971e..efdd746ee 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -72,9 +72,11 @@ app.use(mount("/proxy", proxyServer)); const router = new Router(); const mastoRouter = new Router(); -mastoRouter.use(koaBody({ - urlencoded: true -})); +mastoRouter.use( + koaBody({ + urlencoded: true, + }), +); // Routing router.use(activityPub.routes()); @@ -159,9 +161,9 @@ mastoRouter.post("/oauth/token", async (ctx) => { ctx.body = { error: "Invalid code" }; return; } - } + } if (client_id instanceof Array) { - client_id = client_id.toString();; + client_id = client_id.toString(); } else if (!client_id) { client_id = null; } @@ -169,7 +171,7 @@ mastoRouter.post("/oauth/token", async (ctx) => { const atData = await client.fetchAccessToken( client_id, body.client_secret, - m ? m[0] : '', + m ? m[0] : "", ); ctx.body = { access_token: atData.accessToken,