1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 17:10: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, "requires_restart": true,
"type": "bool", "type": "bool",
"value": false, "value": false,
"description": "Enable TLS." "description": "Serve application over TLS, with HTTP2 preload.",
"wiki_link": "https://wiki.jfa-go.com/docs/tls/"
}, },
"tls_port": { "tls_port": {
"name": "TLS Port", "name": "TLS Port",
@ -567,7 +568,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Captcha", "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": { "settings": {
"enabled": { "enabled": {
@ -766,7 +768,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Messages/Notifications", "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": { "settings": {
"enabled": { "enabled": {
@ -1026,7 +1029,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Discord", "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": { "settings": {
"enabled": { "enabled": {
@ -1147,7 +1151,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Telegram", "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": { "settings": {
"enabled": { "enabled": {
@ -1211,7 +1216,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Matrix", "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": { "settings": {
"enabled": { "enabled": {
@ -1313,7 +1319,8 @@
"meta": { "meta": {
"name": "Password Resets", "name": "Password Resets",
"description": "Settings for the password reset handler.", "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": { "settings": {
"enabled": { "enabled": {
@ -1330,7 +1337,7 @@
"value": "", "value": "",
"depends_true": "enabled", "depends_true": "enabled",
"required": "false", "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": { "watch_directory": {
"name": "Jellyfin directory", "name": "Jellyfin directory",
@ -1499,8 +1506,8 @@
"notifications": { "notifications": {
"order": [], "order": [],
"meta": { "meta": {
"name": "Notifications", "name": "Admin invite notifications",
"description": "Notification related settings.", "description": "Allows toggling \"user created\" and \"invite expired\" notifications to be sent to the admin per-invite.",
"depends_true": "messages|enabled" "depends_true": "messages|enabled"
}, },
"settings": { "settings": {
@ -1558,7 +1565,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Ombi Integration", "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": { "settings": {
"enabled": { "enabled": {
@ -1653,7 +1661,8 @@
"order": [], "order": [],
"meta": { "meta": {
"name": "Backups", "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": { "settings": {
"enabled": { "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> <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> </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> <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"> <div id="settings-loader" class="flex flex-row flex-wrap 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 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> <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> </div>
<div class="card ~neutral @low overflow flex-1" id="settings-panel"> <div class="card ~neutral @low overflow flex-1" id="settings-panel">

View File

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

View File

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

15
package-lock.json generated
View File

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

View File

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

View File

@ -19,6 +19,7 @@ interface Meta {
advanced?: boolean; advanced?: boolean;
depends_true?: string; depends_true?: string;
depends_false?: string; depends_false?: string;
wiki_link?: string;
} }
interface Setting { interface Setting {
@ -31,6 +32,7 @@ interface Setting {
value: string | boolean | number; value: string | boolean | number;
depends_true?: string; depends_true?: string;
depends_false?: string; depends_false?: string;
wiki_link?: string;
asElement: () => HTMLElement; asElement: () => HTMLElement;
update: (s: Setting) => void; update: (s: Setting) => void;
@ -555,10 +557,19 @@ class sectionPanel {
this._section = document.createElement("div") as HTMLDivElement; this._section = document.createElement("div") as HTMLDivElement;
this._section.classList.add("settings-section", "unfocused"); this._section.classList.add("settings-section", "unfocused");
this._section.setAttribute("data-section", sectionName); 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> <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> <p class="support lg my-2 settings-section-description">${s.meta.description}</p>
`; `;
this._section.innerHTML = innerHTML;
this.update(s); this.update(s);
} }