mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2025-04-13 09:44:40 +00:00
merge: feat: Allow injection of raw HTML strings inside <head> (!959)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/959 Closes #1029 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
7faef0d11e
4 changed files with 23 additions and 0 deletions
|
@ -425,3 +425,11 @@ attachLdSignatureForRelays: true
|
||||||
# If you're not using jemalloc, this may cause memory fragmentation and performance issues! (https://www.npmjs.com/package/ws#websocket-compression)
|
# If you're not using jemalloc, this may cause memory fragmentation and performance issues! (https://www.npmjs.com/package/ws#websocket-compression)
|
||||||
# jemalloc is used by default in the Sharkey Docker image and may be set up manually otherwise: https://github.com/jemalloc/jemalloc/wiki/getting-started
|
# jemalloc is used by default in the Sharkey Docker image and may be set up manually otherwise: https://github.com/jemalloc/jemalloc/wiki/getting-started
|
||||||
websocketCompression: false
|
websocketCompression: false
|
||||||
|
|
||||||
|
# Inject arbitrary HTML tags to customize Sharkey without having to fork it
|
||||||
|
#customHtml:
|
||||||
|
# head: |
|
||||||
|
# <!-- The possibilities are limitless! -->
|
||||||
|
# <script>console.log("Hello, world!")</script>
|
||||||
|
# <style>.whatever { color: red; }</style>
|
||||||
|
# <link rel="stylesheet" href="https://example.com/styles.css">
|
||||||
|
|
|
@ -138,6 +138,10 @@ type Source = {
|
||||||
};
|
};
|
||||||
|
|
||||||
websocketCompression?: boolean;
|
websocketCompression?: boolean;
|
||||||
|
|
||||||
|
customHtml?: {
|
||||||
|
head?: string;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Config = {
|
export type Config = {
|
||||||
|
@ -257,6 +261,10 @@ export type Config = {
|
||||||
};
|
};
|
||||||
|
|
||||||
websocketCompression?: boolean;
|
websocketCompression?: boolean;
|
||||||
|
|
||||||
|
customHtml: {
|
||||||
|
head: string;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FulltextSearchProvider = 'sqlLike' | 'sqlPgroonga' | 'meilisearch' | 'sqlTsvector';
|
export type FulltextSearchProvider = 'sqlLike' | 'sqlPgroonga' | 'meilisearch' | 'sqlTsvector';
|
||||||
|
@ -406,6 +414,9 @@ export function loadConfig(): Config {
|
||||||
maxAge: config.activityLogging?.maxAge ?? (1000 * 60 * 60 * 24 * 30),
|
maxAge: config.activityLogging?.maxAge ?? (1000 * 60 * 60 * 24 * 30),
|
||||||
},
|
},
|
||||||
websocketCompression: config.websocketCompression ?? false,
|
websocketCompression: config.websocketCompression ?? false,
|
||||||
|
customHtml: {
|
||||||
|
head: config.customHtml?.head ?? '',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,4 +569,5 @@ function applyEnvOverrides(config: Source) {
|
||||||
_apply_top([['signToActivityPubGet', 'checkActivityPubGetSignature', 'setupPassword']]);
|
_apply_top([['signToActivityPubGet', 'checkActivityPubGetSignature', 'setupPassword']]);
|
||||||
_apply_top(['logging', 'sql', ['disableQueryTruncation', 'enableQueryParamLogging']]);
|
_apply_top(['logging', 'sql', ['disableQueryTruncation', 'enableQueryParamLogging']]);
|
||||||
_apply_top(['activityLogging', ['enabled', 'preSave', 'maxAge']]);
|
_apply_top(['activityLogging', ['enabled', 'preSave', 'maxAge']]);
|
||||||
|
_apply_top(['customHtml', ['head']]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,6 +521,7 @@ export class ClientServerService {
|
||||||
url: this.config.url,
|
url: this.config.url,
|
||||||
title: this.meta.name ?? 'Sharkey',
|
title: this.meta.name ?? 'Sharkey',
|
||||||
desc: this.meta.description,
|
desc: this.meta.description,
|
||||||
|
customHead: this.config.customHtml.head,
|
||||||
...await this.generateCommonPugData(this.meta),
|
...await this.generateCommonPugData(this.meta),
|
||||||
...data,
|
...data,
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,6 +45,8 @@ html
|
||||||
link(rel='stylesheet' href=`/static-assets/fonts/sharkey-icons/style.css?version=${version}`)
|
link(rel='stylesheet' href=`/static-assets/fonts/sharkey-icons/style.css?version=${version}`)
|
||||||
link(rel='modulepreload' href=`/vite/${entry.file}`)
|
link(rel='modulepreload' href=`/vite/${entry.file}`)
|
||||||
|
|
||||||
|
| !{customHead}
|
||||||
|
|
||||||
if !config.frontendManifestExists
|
if !config.frontendManifestExists
|
||||||
script(type="module" src="/vite/@vite/client")
|
script(type="module" src="/vite/@vite/client")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue