Skip to content

Commit 44b9caf

Browse files
committed
Update wiki links
1 parent 6b537b4 commit 44b9caf

3 files changed

Lines changed: 199 additions & 106 deletions

File tree

bin/data.js

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { cwd, releaseData } from './common.js'
44
import fs from 'fs'
55
import dayjs from 'dayjs'
66
import j5 from 'json5'
7+
import { wikiLinks } from './wiki-links.js'
78

89
config()
910

@@ -145,7 +146,7 @@ function createReleaseData () {
145146
if (cname.endsWith('.rpm')) {
146147
nr.desc = isLegacy ? 'for Red Hat, Fedora... (glibc < 2.34)' : 'for Red Hat, Fedora...'
147148
} else if (cname.endsWith('.deb')) {
148-
nr.desc = isLegacy ? 'for Debian, Ubuntu... (glibc < 2.34, like UOS/Ubuntu 18)' : 'for Debian, Ubuntu...'
149+
nr.desc = isLegacy ? 'for Debian, Ubuntu... (glibc < 2.34, like UOS/Kylin/Ubuntu 18)' : 'for Debian, Ubuntu...'
149150
} else if (cname.endsWith('.snap')) {
150151
nr.desc = 'for all linux that support snap'
151152
} else if (cname.endsWith('.gz')) {
@@ -311,110 +312,6 @@ export default {
311312
{
312313
url: 'https://gh-proxy.com',
313314
title: 'https://gh-proxy.com'
314-
},
315-
{
316-
url: 'https://github.com/electerm/electerm/wiki',
317-
title: 'Home'
318-
},
319-
{
320-
url: 'https://github.com/electerm/electerm/wiki/AI-model-config-guide',
321-
title: 'AI model config guide'
322-
},
323-
{
324-
url: 'https://github.com/electerm/electerm/wiki/Autorun-electerm-when-login-to-os',
325-
title: 'Autorun electerm when login to os'
326-
},
327-
{
328-
url: 'https://github.com/electerm/electerm/wiki/batch-operation',
329-
title: 'batch operation'
330-
},
331-
{
332-
url: 'https://github.com/electerm/electerm/wiki/Command-line-usage',
333-
title: 'Command line usage'
334-
},
335-
{
336-
url: 'https://github.com/electerm/electerm/wiki/Connection-Hopping-Behavior-Change-in-electerm-since-v1.50.65',
337-
title: 'Connection Hopping Behavior Change in electerm since v1.50.65'
338-
},
339-
{
340-
url: 'https://github.com/electerm/electerm/wiki/Contributors',
341-
title: 'Contributors'
342-
},
343-
{
344-
url: 'https://github.com/electerm/electerm/wiki/Create-personal-access-token',
345-
title: 'Create personal access token'
346-
},
347-
{
348-
url: 'https://github.com/electerm/electerm/wiki/Create-secret-gist',
349-
title: 'Create secret gist'
350-
},
351-
{
352-
url: 'https://github.com/electerm/electerm/wiki/Custom-CSS-examples',
353-
title: 'Custom CSS examples'
354-
},
355-
{
356-
url: 'https://github.com/electerm/electerm/wiki/Custom-sync-server',
357-
title: 'Custom sync server'
358-
},
359-
{
360-
url: 'https://github.com/electerm/electerm/wiki/Deep-link-support',
361-
title: 'Deep link support'
362-
},
363-
{
364-
url: 'https://github.com/electerm/electerm/wiki/Default-Profile',
365-
title: 'Default Profile'
366-
},
367-
{
368-
url: 'https://github.com/electerm/electerm/wiki/Develop-in-windows',
369-
title: 'Develop in windows'
370-
},
371-
{
372-
url: 'https://github.com/electerm/electerm/wiki/How-Electerm-Gets-the-Current-Working-Directory-(pwd)-in-Terminal-When-"SFTP-Follow-Terminal-Path"-Is-Enabled',
373-
title: 'How Electerm Gets the Current Working Directory (pwd) in Terminal When "SFTP Follow Terminal Path" Is Enabled'
374-
},
375-
{
376-
url: 'https://github.com/electerm/electerm/wiki/How-to-use-ssh-tunnel',
377-
title: 'How to use ssh tunnel'
378-
},
379-
{
380-
url: 'https://github.com/electerm/electerm/wiki/In-windows-can-not-access-port-30975-issue',
381-
title: 'In windows can not access port 30975 issue'
382-
},
383-
{
384-
url: 'https://github.com/electerm/electerm/wiki/RDP-limitation',
385-
title: 'RDP limitation'
386-
},
387-
{
388-
url: 'https://github.com/electerm/electerm/wiki/RDP-session-known-issues',
389-
title: 'RDP session known issues'
390-
},
391-
{
392-
url: 'https://github.com/electerm/electerm/wiki/Sponsor-electerm',
393-
title: 'Sponsor electerm'
394-
},
395-
{
396-
url: 'https://github.com/electerm/electerm/wiki/Terminal-keywords-highlight-regular-expression-exmaples',
397-
title: 'Terminal keywords highlight regular expression exmaples'
398-
},
399-
{
400-
url: 'https://github.com/electerm/electerm/wiki/VNC‐session‐known‐issues',
401-
title: 'VNC session known issues'
402-
},
403-
{
404-
url: 'https://github.com/electerm/electerm/wiki/Warning-about-sftp-follow-ssh-path-function',
405-
title: 'Warning about sftp follow ssh path function'
406-
},
407-
{
408-
url: 'https://github.com/electerm/electerm/wiki/privacy-notice',
409-
title: 'privacy notice'
410-
},
411-
{
412-
url: 'https://github.com/electerm/electerm/wiki/proxy-format',
413-
title: 'proxy format'
414-
},
415-
{
416-
url: 'https://github.com/electerm/electerm/wiki/quick-command-templates',
417-
title: 'quick command templates'
418315
}
419-
]
316+
].concat(wikiLinks)
420317
}

bin/get-wiki.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { exec } from 'child_process'
2+
import fs from 'fs'
3+
import path from 'path'
4+
import { fileURLToPath } from 'url'
5+
6+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
7+
const wikiRepo = 'https://github.com/electerm/electerm.wiki.git'
8+
const tempDir = path.join(__dirname, '..', 'temp-wiki')
9+
10+
// Clone the wiki repo
11+
exec(`git clone ${wikiRepo} ${tempDir}`, (error, stdout, stderr) => {
12+
if (error) {
13+
console.error(`Error cloning wiki: ${error}`)
14+
return
15+
}
16+
17+
// Get all .md files
18+
const mdFiles = fs.readdirSync(tempDir).filter(file => file.endsWith('.md'))
19+
20+
const links = []
21+
22+
mdFiles.forEach(file => {
23+
const filePath = path.join(tempDir, file)
24+
const content = fs.readFileSync(filePath, 'utf8')
25+
const lines = content.split('\n')
26+
let title = ''
27+
28+
// Find the first # header
29+
for (const line of lines) {
30+
if (line.startsWith('# ')) {
31+
title = line.substring(2).trim()
32+
break
33+
}
34+
}
35+
36+
if (!title) {
37+
// If no # header, use filename without .md
38+
title = file.replace('.md', '').replace(/-/g, ' ')
39+
}
40+
41+
// Construct URL: filename without .md, with - instead of spaces
42+
const urlSlug = file.replace('.md', '').replace(/ /g, '-')
43+
const url = `https://github.com/electerm/electerm/wiki/${urlSlug}`
44+
45+
links.push({ url, title })
46+
})
47+
48+
// Sort by title
49+
links.sort((a, b) => a.title.localeCompare(b.title))
50+
51+
// Write to bin/wiki-links.js
52+
const output = `export const wikiLinks = [
53+
${links.map((link, index) => ` {
54+
url: '${link.url}',
55+
title: '${link.title.replace(/'/g, "\\'")}'
56+
}${index < links.length - 1 ? ',' : ''}`).join('\n')}
57+
]
58+
`
59+
const outputPath = path.join(__dirname, 'wiki-links.js')
60+
fs.writeFileSync(outputPath, output)
61+
62+
// Clean up temp dir
63+
exec(`rm -rf ${tempDir}`, (error) => {
64+
if (error) {
65+
console.error(`Error cleaning up: ${error}`)
66+
}
67+
})
68+
69+
console.log(`Wiki links exported to ${outputPath}`)
70+
})

bin/wiki-links.js

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
export const wikiLinks = [
2+
{
3+
url: 'https://github.com/electerm/electerm/wiki/AI-model-config-guide',
4+
title: 'AI Configuration Guide'
5+
},
6+
{
7+
url: 'https://github.com/electerm/electerm/wiki/batch-operation',
8+
title: 'batch operation'
9+
},
10+
{
11+
url: 'https://github.com/electerm/electerm/wiki/Command-line-usage',
12+
title: 'Command line usage'
13+
},
14+
{
15+
url: 'https://github.com/electerm/electerm/wiki/Connection-Hopping-Behavior-Change-in-electerm-since-v1.50.65',
16+
title: 'Connection Hopping Behavior Change since v1.50.65 (v1.50.65版本后连接跳转行为变化)'
17+
},
18+
{
19+
url: 'https://github.com/electerm/electerm/wiki/Contributors',
20+
title: 'Contributors'
21+
},
22+
{
23+
url: 'https://github.com/electerm/electerm/wiki/Create-personal-access-token',
24+
title: 'Create personal access token'
25+
},
26+
{
27+
url: 'https://github.com/electerm/electerm/wiki/Create-secret-gist',
28+
title: 'Create secret gist'
29+
},
30+
{
31+
url: 'https://github.com/electerm/electerm/wiki/Custom-CSS-examples',
32+
title: 'Custom CSS examples(自定义CSS样例)'
33+
},
34+
{
35+
url: 'https://github.com/electerm/electerm/wiki/Custom-sync-server',
36+
title: 'Custom sync server'
37+
},
38+
{
39+
url: 'https://github.com/electerm/electerm/wiki/Deep-link-support',
40+
title: 'Deep Link Support for Electerm'
41+
},
42+
{
43+
url: 'https://github.com/electerm/electerm/wiki/Default-Profile',
44+
title: 'Default Profile'
45+
},
46+
{
47+
url: 'https://github.com/electerm/electerm/wiki/Develop-in-windows',
48+
title: 'Develop in windows'
49+
},
50+
{
51+
url: 'https://github.com/electerm/electerm/wiki/Home',
52+
title: 'Home'
53+
},
54+
{
55+
url: 'https://github.com/electerm/electerm/wiki/How-Electerm-Gets-the-Current-Working-Directory-(pwd)-in-Terminal-When-"SFTP-Follow-Terminal-Path"-Is-Enabled',
56+
title: 'How Electerm Gets the Current Working Directory (pwd) in Terminal When "SFTP Follow Terminal Path" Is Enabled'
57+
},
58+
{
59+
url: 'https://github.com/electerm/electerm/wiki/How-to-use-ssh-tunnel',
60+
title: 'How to use ssh tunnel'
61+
},
62+
{
63+
url: 'https://github.com/electerm/electerm/wiki/In-windows-can-not-access-port-30975-issue',
64+
title: 'In windows can not access port 30975 issue'
65+
},
66+
{
67+
url: 'https://github.com/electerm/electerm/wiki/Know-issues',
68+
title: 'Know issues'
69+
},
70+
{
71+
url: 'https://github.com/electerm/electerm/wiki/Autorun-electerm-when-login-to-os',
72+
title: 'make it exe'
73+
},
74+
{
75+
url: 'https://github.com/electerm/electerm/wiki/MCP-Widget-Usage-Guide',
76+
title: 'MCP Widget Usage Guide'
77+
},
78+
{
79+
url: 'https://github.com/electerm/electerm/wiki/privacy-notice',
80+
title: 'privacy notice'
81+
},
82+
{
83+
url: 'https://github.com/electerm/electerm/wiki/proxy-format',
84+
title: 'proxy format 代理格式'
85+
},
86+
{
87+
url: 'https://github.com/electerm/electerm/wiki/quick-command-templates',
88+
title: 'quick command templates'
89+
},
90+
{
91+
url: 'https://github.com/electerm/electerm/wiki/RDP-session-known-issues',
92+
title: 'RDP Connection Issues in Electerm'
93+
},
94+
{
95+
url: 'https://github.com/electerm/electerm/wiki/RDP-limitation',
96+
title: 'RDP limitation'
97+
},
98+
{
99+
url: 'https://github.com/electerm/electerm/wiki/Sponsor-electerm',
100+
title: 'Sponsor electerm'
101+
},
102+
{
103+
url: 'https://github.com/electerm/electerm/wiki/ssh-agent',
104+
title: 'SSH Agent'
105+
},
106+
{
107+
url: 'https://github.com/electerm/electerm/wiki/Terminal-keywords-highlight-regular-expression-exmaples',
108+
title: 'Terminal keywords highlight regular expression exmaples'
109+
},
110+
{
111+
url: 'https://github.com/electerm/electerm/wiki/Troubleshoot',
112+
title: 'Troubleshoot'
113+
},
114+
{
115+
url: 'https://github.com/electerm/electerm/wiki/VNC‐session‐known‐issues',
116+
title: 'VNC Connection Feature (Beta)'
117+
},
118+
{
119+
url: 'https://github.com/electerm/electerm/wiki/Warning-about-sftp-follow-ssh-path-function',
120+
title: 'Warning about sftp follow ssh path function'
121+
},
122+
{
123+
url: 'https://github.com/electerm/electerm/wiki/Workspace-Feature',
124+
title: 'Workspace Feature / 工作区功能'
125+
}
126+
]

0 commit comments

Comments
 (0)