1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

config: add wiki links

main wiki link included with "about" and "user profiles". Sections with
a relevant page have a linked button next to their title when clicked.
Behaviour added by the "wiki_link" field in the "meta" section of a
config "section".
This commit is contained in:
Harvey Tindall 2024-08-10 20:19:38 +01:00
parent 69569e556a
commit 3a0f61e324
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
7 changed files with 50 additions and 26 deletions

View File

@ -326,7 +326,8 @@
"requires_restart": true,
"type": "bool",
"value": false,
"description": "Enable TLS."
"description": "Serve application over TLS, with HTTP2 preload.",
"wiki_link": "https://wiki.jfa-go.com/docs/tls/"
},
"tls_port": {
"name": "TLS Port",
@ -567,7 +568,8 @@
"order": [],
"meta": {
"name": "Captcha",
"description": "Settings related to user creation CAPTCHAs."
"description": "Settings related to user creation CAPTCHAs.",
"wiki_link": "https://wiki.jfa-go.com/docs/captcha/"
},
"settings": {
"enabled": {
@ -766,7 +768,8 @@
"order": [],
"meta": {
"name": "Messages/Notifications",
"description": "General settings for emails/messages."
"description": "General settings for emails/messages.",
"wiki_link": "https://wiki.jfa-go.com/docs/emails/"
},
"settings": {
"enabled": {
@ -1026,7 +1029,8 @@
"order": [],
"meta": {
"name": "Discord",
"description": "Settings for Discord invites/signup/notifications"
"description": "Settings for Discord invites/signup/notifications",
"wiki_link": "https://wiki.jfa-go.com/docs/bots/discord/"
},
"settings": {
"enabled": {
@ -1147,7 +1151,8 @@
"order": [],
"meta": {
"name": "Telegram",
"description": "Settings for Telegram signup/notifications. See the jfa-go wiki for info on setting this up."
"description": "Settings for Telegram signup/notifications. See the jfa-go wiki for info on setting this up.",
"wiki_link": "https://wiki.jfa-go.com/docs/bots/telegram/"
},
"settings": {
"enabled": {
@ -1211,7 +1216,8 @@
"order": [],
"meta": {
"name": "Matrix",
"description": "Settings for Matrix invites/signup/notifications. See the jfa-go wiki for info on setting this up."
"description": "Settings for Matrix invites/signup/notifications. See the jfa-go wiki for info on setting this up.",
"wiki_link": "https://wiki.jfa-go.com/docs/bots/matrix/"
},
"settings": {
"enabled": {
@ -1313,7 +1319,8 @@
"meta": {
"name": "Password Resets",
"description": "Settings for the password reset handler.",
"depends_true": "messages|enabled"
"depends_true": "messages|enabled",
"wiki_link": "https://wiki.jfa-go.com/docs/pwr/"
},
"settings": {
"enabled": {
@ -1330,7 +1337,7 @@
"value": "",
"depends_true": "enabled",
"required": "false",
"description": "There are multiple ways password resets can be set up. See the <a href=\"https://wiki.jfa-go.com/docs/pwr/\" target=\"_blank\">wiki page</a> for more information."
"description": "There are multiple ways password resets can be set up. See the wiki page for more information."
},
"watch_directory": {
"name": "Jellyfin directory",
@ -1499,8 +1506,8 @@
"notifications": {
"order": [],
"meta": {
"name": "Notifications",
"description": "Notification related settings.",
"name": "Admin invite notifications",
"description": "Allows toggling \"user created\" and \"invite expired\" notifications to be sent to the admin per-invite.",
"depends_true": "messages|enabled"
},
"settings": {
@ -1558,7 +1565,8 @@
"order": [],
"meta": {
"name": "Ombi Integration",
"description": "Connect to Ombi to automatically create both Ombi and Jellyfin accounts for new users. You'll need to add a ombi template to an existing User Profile for accounts to be created, which you can do by refreshing then checking Settings > User Profiles. To handle password resets for Ombi & Jellyfin, enable \"Use reset link instead of PIN\"."
"description": "Connect to Ombi to automatically create both Ombi and Jellyfin accounts for new users. You'll need to add a ombi template to an existing User Profile for accounts to be created, which you can do by refreshing then checking Settings > User Profiles. To handle password resets for Ombi & Jellyfin, enable \"Use reset link instead of PIN\".",
"wiki_link": "https://wiki.jfa-go.com/docs/ombi/"
},
"settings": {
"enabled": {
@ -1653,7 +1661,8 @@
"order": [],
"meta": {
"name": "Backups",
"description": "Settings for database backups. Press the \"Backups\" button above to create, download and restore backups."
"description": "Settings for database backups. Press the \"Backups\" button above to create, download and restore backups.",
"wiki_link": "https://wiki.jfa-go.com/docs/backups/"
},
"settings": {
"enabled": {

View File

@ -916,9 +916,10 @@
<button class="button ~neutral @low center -ml-10 rounded-s-none settings-search-clear" aria-label="{{ .strings.clearSearch }}" text="{{ .strings.clearSearch }}"><i class="ri-close-line"></i></button>
</div>
<aside class="aside sm ~urge dark:~d_info @low" id="settings-message">Note: <span class="badge ~critical">*</span> indicates a required field, <span class="badge ~info dark:~d_warning">R</span> indicates changes require a restart.</aside>
<div id="settings-loader" class="flex flex-row gap-2">
<span class="button ~neutral @low settings-section-button justify-center grow" id="setting-about"><span class="flex">{{ .strings.aboutProgram }} <i class="ri-information-line ml-2"></i></span></span>
<span class="button ~neutral @low settings-section-button justify-center grow" id="setting-profiles"><span class="flex">{{ .strings.userProfiles }} <i class="ri-user-line ml-2"></i></span></span>
<div id="settings-loader" class="flex flex-row flex-wrap gap-2">
<span class="button ~neutral @low justify-center grow" id="setting-about"><span class="flex">{{ .strings.aboutProgram }} <i class="ri-information-line ml-2"></i></span></span>
<a class="button ~urge dark:~d_info @low justify-center grow" target="_blank" href="https://wiki.jfa-go.com" id="setting-wiki-reference-anchor"><span class="flex">{{ .strings.wiki }} <i class="ri-book-shelf-line ml-2"></i></a>
<span class="button ~neutral @low justify-center grow" id="setting-profiles"><span class="flex">{{ .strings.userProfiles }} <i class="ri-user-line ml-2"></i></span></span>
</div>
</div>
<div class="card ~neutral @low overflow flex-1" id="settings-panel">

View File

@ -201,7 +201,8 @@
"backupCreated": "Backup created",
"backupCanBeFound": "The backup can be found on the server at {filepath}.",
"backupCanDownload": "Alternatively, click below to download the backup.",
"wikiPage": "Wiki Page"
"wikiPage": "Wiki Page",
"wiki": "Wiki"
},
"notifications": {
"pathCopied": "Full path copied to clipboard.",

View File

@ -214,6 +214,7 @@ type meta struct {
Advanced bool `json:"advanced,omitempty"`
DependsTrue string `json:"depends_true,omitempty"`
DependsFalse string `json:"depends_false,omitempty"`
WikiLink string `json:"wiki_link,omitempty"`
}
type setting struct {

15
package-lock.json generated
View File

@ -23,7 +23,7 @@
"nightwind": "^1.1.13",
"perl-regex": "^1.0.4",
"postcss": "^8.4.24",
"remixicon": "^3.3.0",
"remixicon": "^4.3.0",
"remove-markdown": "^0.5.0",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",
@ -4573,9 +4573,10 @@
}
},
"node_modules/remixicon": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-3.3.0.tgz",
"integrity": "sha512-iNeRbwVgd8Ef467IjMd/+joFWSBOYfqsLtxtSzsS8fWn75a1H7sgGu5uWE4c3NLjP2C1giFlx8gw63qZd96yJQ=="
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-4.3.0.tgz",
"integrity": "sha512-jRYQ37dTFSkJtvcxwTUAkIiXkYRvA9EDvVuXPNrmt2xf/VS//CRgFtsX2TAFBoQOhh9SDh7l6La4Xu12snEyxg==",
"license": "Apache-2.0"
},
"node_modules/remove-markdown": {
"version": "0.5.0",
@ -10183,9 +10184,9 @@
"integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog=="
},
"remixicon": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-3.3.0.tgz",
"integrity": "sha512-iNeRbwVgd8Ef467IjMd/+joFWSBOYfqsLtxtSzsS8fWn75a1H7sgGu5uWE4c3NLjP2C1giFlx8gw63qZd96yJQ=="
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-4.3.0.tgz",
"integrity": "sha512-jRYQ37dTFSkJtvcxwTUAkIiXkYRvA9EDvVuXPNrmt2xf/VS//CRgFtsX2TAFBoQOhh9SDh7l6La4Xu12snEyxg=="
},
"remove-markdown": {
"version": "0.5.0",

View File

@ -31,7 +31,7 @@
"nightwind": "^1.1.13",
"perl-regex": "^1.0.4",
"postcss": "^8.4.24",
"remixicon": "^3.3.0",
"remixicon": "^4.3.0",
"remove-markdown": "^0.5.0",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3",

View File

@ -19,6 +19,7 @@ interface Meta {
advanced?: boolean;
depends_true?: string;
depends_false?: string;
wiki_link?: string;
}
interface Setting {
@ -31,6 +32,7 @@ interface Setting {
value: string | boolean | number;
depends_true?: string;
depends_false?: string;
wiki_link?: string;
asElement: () => HTMLElement;
update: (s: Setting) => void;
@ -555,10 +557,19 @@ class sectionPanel {
this._section = document.createElement("div") as HTMLDivElement;
this._section.classList.add("settings-section", "unfocused");
this._section.setAttribute("data-section", sectionName);
this._section.innerHTML = `
let innerHTML = `
<div class="flex flex-row justify-between">
<span class="heading">${s.meta.name}</span>
`;
if (s.meta.wiki_link) {
innerHTML += `<a class="button ~urge dark:~d_info @low justify-center" target="_blank" href="${s.meta.wiki_link}" title="${window.lang.strings("wiki")}"><i class="ri-book-shelf-line"></i></a>`;
}
innerHTML += `
</div>
<p class="support lg my-2 settings-section-description">${s.meta.description}</p>
`;
this._section.innerHTML = innerHTML;
this.update(s);
}