@samitouri / QOSami-HFS / commits / 298c59cd

avoid non-compliance with markdown

Massimo Melina committed Aug 3, 2023 at 19:05 UTC 298c59cd04cf0bcdac3b98387e8ad596e05ff7da
5 files changed +12 -14
admin/src/HomePage.ts
+3 -3
@@ -57,7 +57,7 @@ export default function HomePage() {
57 v.busy ? [`port ${v.port} already used by ${v.busy}${SOLUTION_SEP}choose a `, cfgLink('different port'), ` or stop ${v.busy}`]
58 : v.error )
59 const errors = serverErrors && onlyTruthy(Object.entries(serverErrors).map(([k,v]) =>
60 - v && [md(`Protocol _${k}_ cannot work: `), v,
60 + v && [md(`Protocol <u>${k}</u> cannot work: `), v,
61 (isCertError(v) || isKeyError(v)) && [
62 SOLUTION_SEP, h(Link, {
63 sx: { cursor: 'pointer' },
@@ -78,7 +78,7 @@ export default function HomePage() {
78 !errors.length && [ SOLUTION_SEP, cfgLink("switch http or https on") ]
79 ),
80 plugins.find(x => x.badApi) && entry('warning', "Some plugins may be incompatible"),
81 - !account?.adminActualAccess && entry('', md("On _localhost_ you don't need to login"),
81 + !account?.adminActualAccess && entry('', md("On <u>localhost</u> you don't need to login"),
82 SOLUTION_SEP, "to access from another computer ", h(InLink, { to:'accounts' }, md("create an account with *admin* permission")) ),
83 proxyWarning(cfg, status) && entry('warning', proxyWarning(cfg, status),
84 SOLUTION_SEP, cfgLink("set the number of proxies"),
@@ -96,7 +96,7 @@ export default function HomePage() {
96 status.frpDetected && entry('warning', `FRP is detected. It should not be used with "type = tcp" with HFS. Possible solutions are`,
97 h('ol',{},
98 h('li',{}, `configure FRP with type=http (best solution)`),
99 - h('li',{}, md(`configure FRP to connect to HFS _not_ with 127.0.0.1 (safe, but you won't see users' IPs)`)),
99 + h('li',{}, md(`configure FRP to connect to HFS <u>not</u> with 127.0.0.1 (safe, but you won't see users' IPs)`)),
100 h('li',{}, `disable "admin access for localhost" in HFS (safe, but you won't see users' IPs)`),
101 )),
102 entry('', h(Link, { target: 'support', href: REPO_URL + 'discussions' }, "Get support")),
admin/src/md.ts
+3 -4
@@ -7,17 +7,16 @@ const TAGS = {
7 '`': 'code',
8 '*': 'i',
9 '**': 'b',
10 - '_': 'u',
10 }
12 -// markdown inspired syntax to transform text into react elements: * for bold, / for italic, _ for underline, ` for code
11 type OnText = (s: string) => ReactNode
12 export default function md(text: string | TemplateStringsArray, { linkTarget='', onText=(x=>x) as OnText }={}) {
13 if (typeof text !== 'string')
14 text = text[0]
17 - return replaceStringToReact(text, /(`|_|\*\*?)(.+)\1|(\n)|\[(.+)\]\((.+)\)/g, m =>
15 + return replaceStringToReact(text, /(`|_|\*\*?)(.+)\1|(\n)|\[(.+)\]\((.+)\)|<([^ >/]+)>(.*)<\/\6>|<([^ >/]+) *\/>/g, m =>
16 m[4] ? h(Link, { href: m[5], target: linkTarget }, onText(m[4]))
17 : m[3] ? h('br')
20 - : h((TAGS as any)[ m[1] ], {}, onText(m[2])),
18 + : m[1] ? h((TAGS as any)[ m[1] ], {}, onText(m[2]))
19 + : h(m[6] || m[8], {}, m[7]),
20 onText)
21 }
22
frontend/src/show.ts
+2 -3
@@ -6,7 +6,6 @@ import { EntryDetails, useMidnight } from './BrowseFiles'
6 import { Flex, FlexV, Html, iconBtn, Spinner } from './components'
7 import { openFileMenu } from './fileMenu'
8 import { useI18N } from './i18n'
9 -import md from '@hfs/admin/src/md'
9 import { alertDialog } from './dialog'
10
11 enum ZoomMode {
@@ -79,8 +78,8 @@ export function fileShow(entry: DirEntry) {
78 useWindowSize().width > 1280 && iconBtn('?', showHelp),
79 iconBtn('menu', ev => openFileMenu(cur, ev, [
80 'open','delete',
82 - { id: 'zoom', icon: 'zoom', label: md(t`Switch _z_oom mode`), onClick: switchZoomMode },
83 - { id: 'fullscreen', icon: 'fullscreen', label: md(t`_F_ull screen`), onClick: toggleFullScreen },
81 + { id: 'zoom', icon: 'zoom', label: t`Switch zoom mode`, onClick: switchZoomMode },
82 + { id: 'fullscreen', icon: 'fullscreen', label: t`Full screen`, onClick: toggleFullScreen },
83 ])),
84 iconBtn('close', close),
85 )
src/langs/hfs-lang-en.json
+2 -2
@@ -121,7 +121,7 @@
121 "Operation successful": "Operation successful",
122 "Uploader": "Uploader",
123 "Download counter": "Download counter",
124 - "Switch _z_oom mode": "Switch _z_oom mode",
125 - "_F_ull screen": "_F_ull screen"
124 + "Switch zoom mode": "Switch zoom mode",
125 + "Full screen": "Full screen"
126 }
127 }
src/langs/hfs-lang-it.json
+2 -2
@@ -115,7 +115,7 @@
115 "Operation successful": "Operazione riuscita",
116 "Uploader": "Upload da",
117 "Download counter": "Download conteggiati",
118 - "Switch _z_oom mode": "Cambia _z_oom",
119 - "_F_ull screen": "Pieno schermo (_F_)"
118 + "Switch zoom mode": "Cambia zoom",
119 + "Full screen": "Pieno schermo"
120 }
121 }