Skip to content

Commit

Permalink
feat: add custom footer support
Browse files Browse the repository at this point in the history
  • Loading branch information
OXeu committed Jul 10, 2024
1 parent 155df16 commit 16da5b2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
"desc": "Set the icon (Favicon) displayed in the browser's address bar",
"title": "Favicon"
},
"footer": {
"desc": "Set the footer content of the site (HTML)",
"title": "Footer"
},
"friend": {
"apply": {
"desc": "Allow other users to apply for friend links (requires review)",
Expand Down
4 changes: 4 additions & 0 deletions client/public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
"desc": "ブラウザのアドレスバーに表示されるアイコン(ファビコン)を設定します。",
"title": "ファビコン"
},
"footer": {
"desc": "サイトのフッターコンテンツを設定する(HTML)",
"title": "フッター"
},
"friend": {
"apply": {
"desc": "他のユーザーが友人リンクを申請できるようにする(審査が必要)",
Expand Down
4 changes: 4 additions & 0 deletions client/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
"desc": "设置显示于浏览器的地址栏的图标(Favicon)",
"title": "网站图标"
},
"footer": {
"desc": "设置显示于站点底部的内容(HTML)",
"title": "站点底部内容"
},
"friend": {
"apply": {
"desc": "允许其他用户申请友链(需审核)",
Expand Down
2 changes: 2 additions & 0 deletions client/src/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function Footer() {
const { t } = useTranslation()
const [modeState, setModeState] = useState<ThemeMode>('system');
const config = useContext(ClientConfigContext);
const footerHtml = config.get<string>('footer');
useEffect(() => {
const mode = localStorage.getItem('theme') as ThemeMode || 'system';
setModeState(mode);
Expand Down Expand Up @@ -42,6 +43,7 @@ function Footer() {
<link rel="alternate" type="application/json" title={siteName} href="/sub/rss.json" />
</Helmet>
<div className="flex flex-col mb-8 space-y-2 justify-center items-center t-primary ani-show">
{footerHtml && <div dangerouslySetInnerHTML={{ __html: footerHtml }} />}
<p className='text-sm text-neutral-500 font-normal link-line'>
<span>
© 2024 Powered by <a className='hover:underline' href="https://github.com/openRin/Rin" target="_blank">Rin</a>
Expand Down
1 change: 1 addition & 0 deletions client/src/page/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export function Settings() {
<ItemSwitch title={t('settings.counter.enable.title')} description={t('settings.counter.enable.desc')} type="client" configKey="counter.enabled" />
<ItemSwitch title={t('settings.rss.title')} description={t('settings.rss.desc')} type="client" configKey="rss" />
<ItemInput title={t('settings.favicon.title')} description={t('settings.favicon.desc')} type="client" configKey="favicon" configKeyTitle="Favicon" />
<ItemInput title={t('settings.footer.title')} description={t('settings.footer.desc')} type="client" configKey="footer" configKeyTitle="Footer HTML" />
<ItemButton title={t('settings.cache.clear.title')} description={t('settings.cache.clear.desc')} buttonTitle={t('clear')} onConfirm={async () => {
await client.config.cache.delete(undefined, {
headers: headersWithAuth()
Expand Down

0 comments on commit 16da5b2

Please sign in to comment.