docs: 📝 custom assets

This commit is contained in:
ThatOneCalculator 2023-02-11 13:16:45 -08:00
parent 3de2617d6b
commit 254a9e8716
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
10 changed files with 33 additions and 24 deletions

View File

@ -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 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 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 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`. - To update custom assets without rebuilding, just run `pnpm run gulp`.
## 🧑‍🔬 Configuring a new instance ## 🧑‍🔬 Configuring a new instance

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -128,20 +128,21 @@ export async function createNote(
// Skip if note is made before 2007 (1yr before Fedi was created) // Skip if note is made before 2007 (1yr before Fedi was created)
// OR skip if note is made 3 days in advance // OR skip if note is made 3 days in advance
if (note.published) { if (note.published) {
const DateChecker = new Date(note.published) const DateChecker = new Date(note.published);
const FutureCheck = new Date() const FutureCheck = new Date();
FutureCheck.setDate(FutureCheck.getDate() + 3) // Allow some wiggle room for misconfigured hosts FutureCheck.setDate(FutureCheck.getDate() + 3); // Allow some wiggle room for misconfigured hosts
if (DateChecker.getFullYear() < 2007) { 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; return null;
} }
if (DateChecker > FutureCheck) { if (DateChecker > FutureCheck) {
logger.warn('Note somehow made after today; discarding') logger.warn("Note somehow made after today; discarding");
return null; return null;
} }
} }
// Fetch author // Fetch author
const actor = (await resolvePerson( const actor = (await resolvePerson(
getOneApId(note.attributedTo), getOneApId(note.attributedTo),

View File

@ -669,7 +669,7 @@ const eps = [
["users/stats", ep___users_stats], ["users/stats", ep___users_stats],
["admin/drive-capacity-override", ep___admin_driveCapOverride], ["admin/drive-capacity-override", ep___admin_driveCapOverride],
["fetch-rss", ep___fetchRss], ["fetch-rss", ep___fetchRss],
["get-sounds", ep___sounds] ["get-sounds", ep___sounds],
]; ];
export interface IEndpointMeta { export interface IEndpointMeta {

View File

@ -14,15 +14,17 @@ export const paramDef = {
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async () => {
const music_files: (string|null)[] = [null, ]; const music_files: (string | null)[] = [null];
const directory = (await readdir('./assets/sounds', { withFileTypes: true })) const directory = (
.filter(potentialFolder => potentialFolder.isDirectory()) await readdir("./assets/sounds", { withFileTypes: true })
).filter((potentialFolder) => potentialFolder.isDirectory());
for await (const folder of directory) { for await (const folder of directory) {
const files = (await readdir(`./assets/sounds/${folder.name}`)) const files = (await readdir(`./assets/sounds/${folder.name}`)).filter(
.filter(potentialSong => potentialSong.endsWith('.mp3')) (potentialSong) => potentialSong.endsWith(".mp3"),
);
for await (const file of files) { 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;
}); });

View File

@ -61,10 +61,12 @@ router.use(
}), }),
); );
mastoRouter.use(koaBody({ mastoRouter.use(
multipart: true, koaBody({
urlencoded: true multipart: true,
})); urlencoded: true,
}),
);
apiMastodonCompatible(mastoRouter); apiMastodonCompatible(mastoRouter);

View File

@ -72,9 +72,11 @@ app.use(mount("/proxy", proxyServer));
const router = new Router(); const router = new Router();
const mastoRouter = new Router(); const mastoRouter = new Router();
mastoRouter.use(koaBody({ mastoRouter.use(
urlencoded: true koaBody({
})); urlencoded: true,
}),
);
// Routing // Routing
router.use(activityPub.routes()); router.use(activityPub.routes());
@ -161,7 +163,7 @@ mastoRouter.post("/oauth/token", async (ctx) => {
} }
} }
if (client_id instanceof Array) { if (client_id instanceof Array) {
client_id = client_id.toString();; client_id = client_id.toString();
} else if (!client_id) { } else if (!client_id) {
client_id = null; client_id = null;
} }
@ -169,7 +171,7 @@ mastoRouter.post("/oauth/token", async (ctx) => {
const atData = await client.fetchAccessToken( const atData = await client.fetchAccessToken(
client_id, client_id,
body.client_secret, body.client_secret,
m ? m[0] : '', m ? m[0] : "",
); );
ctx.body = { ctx.body = {
access_token: atData.accessToken, access_token: atData.accessToken,