mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-23 14:46:07 +09:00
docs: 📝 custom assets
This commit is contained in:
parent
861fbcab41
commit
1d89cc3e3d
@ -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
|
||||
|
BIN
custom/assets/badges/error.png
(Stored with Git LFS)
Normal file
BIN
custom/assets/badges/error.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
custom/assets/badges/info.png
(Stored with Git LFS)
Normal file
BIN
custom/assets/badges/info.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
custom/assets/badges/not-found.png
(Stored with Git LFS)
Normal file
BIN
custom/assets/badges/not-found.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -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());
|
||||
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user