docs: 📝 custom assets
This commit is contained in:
parent
3de2617d6b
commit
254a9e8716
|
@ -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
|
||||
|
|
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 |
|
@ -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),
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -61,10 +61,12 @@ router.use(
|
|||
}),
|
||||
);
|
||||
|
||||
mastoRouter.use(koaBody({
|
||||
multipart: true,
|
||||
urlencoded: true
|
||||
}));
|
||||
mastoRouter.use(
|
||||
koaBody({
|
||||
multipart: true,
|
||||
urlencoded: true,
|
||||
}),
|
||||
);
|
||||
|
||||
apiMastodonCompatible(mastoRouter);
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
@ -161,7 +163,7 @@ mastoRouter.post("/oauth/token", async (ctx) => {
|
|||
}
|
||||
}
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue