pinokiod 3.6.33 → 3.6.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/api/index.js +0 -8
- package/kernel/bin/conda.js +12 -11
- package/kernel/bin/index.js +39 -7
- package/kernel/environment.js +6 -0
- package/kernel/index.js +7 -61
- package/kernel/sysinfo.js +0 -1
- package/kernel/util.js +1 -0
- package/package.json +2 -1
- package/server/index.js +62 -2
- package/server/socket.js +0 -1
- package/server/views/settings.ejs +39 -7
package/kernel/api/index.js
CHANGED
|
@@ -567,18 +567,10 @@ class Api {
|
|
|
567
567
|
|
|
568
568
|
}
|
|
569
569
|
async step (request, rawrpc, input, i, total, args) {
|
|
570
|
-
console.log("####### step")
|
|
571
|
-
|
|
572
570
|
console.time("STEP INIT")
|
|
573
571
|
await Promise.all([this.init(), this.kernel.update_sysinfo()])
|
|
574
572
|
console.timeEnd("STEP INIT")
|
|
575
573
|
|
|
576
|
-
// await this.init()
|
|
577
|
-
//
|
|
578
|
-
// console.time("api.update_sysinfo")
|
|
579
|
-
// await this.kernel.update_sysinfo()
|
|
580
|
-
// console.timeEnd("api.update_sysinfo")
|
|
581
|
-
|
|
582
574
|
// clear global regular expression object RegExp.lastMatch (memory leak prevention)
|
|
583
575
|
let r = /\s*/g.exec("");
|
|
584
576
|
|
package/kernel/bin/conda.js
CHANGED
|
@@ -80,8 +80,8 @@ report_errors: false`)
|
|
|
80
80
|
// }
|
|
81
81
|
let pinned_exists = await this.kernel.exists("bin/miniconda/conda-meta")
|
|
82
82
|
if (pinned_exists) {
|
|
83
|
-
await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3
|
|
84
|
-
sqlite ==3.47.2`)
|
|
83
|
+
await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3`)
|
|
84
|
+
//sqlite ==3.47.2`)
|
|
85
85
|
// await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.9.0`)
|
|
86
86
|
// await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.11.2
|
|
87
87
|
//conda-libmamba-solver=24.11.1`)
|
|
@@ -139,14 +139,14 @@ sqlite ==3.47.2`)
|
|
|
139
139
|
// Use sqlite to check if `conda update -y --all` went through successfully
|
|
140
140
|
// sometimes it just fails silently so need to check
|
|
141
141
|
if (name === "sqlite") {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
let coerced = semver.coerce(version)
|
|
143
|
+
let sqlite_requirement = ">=3.47.2"
|
|
144
|
+
if (semver.satisfies(coerced, sqlite_requirement)) {
|
|
145
|
+
console.log("semver satisfied")
|
|
146
|
+
|
|
147
147
|
conda_check.sqlite = true
|
|
148
148
|
} else {
|
|
149
|
-
console.log("
|
|
149
|
+
console.log("semver NOT satisfied")
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -207,8 +207,8 @@ sqlite ==3.47.2`)
|
|
|
207
207
|
let pinned_exists = await this.kernel.exists("bin/miniconda/conda-meta")
|
|
208
208
|
if (pinned_exists) {
|
|
209
209
|
//await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.11.1`)
|
|
210
|
-
await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3
|
|
211
|
-
sqlite ==3.47.2`)
|
|
210
|
+
await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3`)
|
|
211
|
+
//sqlite ==3.47.2`)
|
|
212
212
|
// await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.9.0`)
|
|
213
213
|
// await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.11.2
|
|
214
214
|
//conda-libmamba-solver=24.11.1`)
|
|
@@ -251,7 +251,8 @@ sqlite ==3.47.2`)
|
|
|
251
251
|
//"conda install -y conda-libmamba-solver=24.11.1 conda=24.7.1",
|
|
252
252
|
//"conda install -y conda-libmamba-solver=24.11.1 conda=24.11.2",
|
|
253
253
|
//"conda update -y conda-libmamba-solver",
|
|
254
|
-
"conda update -y conda sqlite",// -vvv --debug",
|
|
254
|
+
//"conda update -y conda sqlite",// -vvv --debug",
|
|
255
|
+
"conda update -y conda",// -vvv --debug",
|
|
255
256
|
"conda update -y --all",// -vvv --debug",
|
|
256
257
|
// "python -m pip install --upgrade pip setuptools wheel",
|
|
257
258
|
// "python -m ensurepip --upgrade",
|
package/kernel/bin/index.js
CHANGED
|
@@ -23,6 +23,8 @@ const { glob } = require('glob')
|
|
|
23
23
|
const fakeUa = require('fake-useragent');
|
|
24
24
|
const fse = require('fs-extra')
|
|
25
25
|
const semver = require('semver')
|
|
26
|
+
const { bootstrap } = require('global-agent')
|
|
27
|
+
const Environment = require('../environment')
|
|
26
28
|
//const imageToAscii = require("image-to-ascii");
|
|
27
29
|
|
|
28
30
|
|
|
@@ -181,6 +183,36 @@ class Bin {
|
|
|
181
183
|
}
|
|
182
184
|
// await fs.promises.mkdir(playwright_folder, { recursive: true }).catch((e) => { })
|
|
183
185
|
}
|
|
186
|
+
|
|
187
|
+
let system_env = await Environment.get(this.kernel.homedir)
|
|
188
|
+
console.log("***********", { system_env })
|
|
189
|
+
|
|
190
|
+
if (system_env.HTTP_PROXY) {
|
|
191
|
+
process.env.GLOBAL_AGENT_HTTP_PROXY = system_env.HTTP_PROXY
|
|
192
|
+
} else {
|
|
193
|
+
if (process.env.GLOBAL_AGENT_HTTP_PROXY) {
|
|
194
|
+
delete process.env.GLOBAL_AGENT_HTTP_PROXY
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (system_env.HTTPS_PROXY) {
|
|
198
|
+
process.env.GLOBAL_AGENT_HTTPS_PROXY = system_env.HTTPS_PROXY
|
|
199
|
+
} else {
|
|
200
|
+
if (process.env.GLOBAL_AGENT_HTTPS_PROXY) {
|
|
201
|
+
delete process.env.GLOBAL_AGENT_HTTPS_PROXY
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (system_env.NO_PROXY) {
|
|
205
|
+
process.env.GLOBAL_AGENT_NO_PROXY = system_env.NO_PROXY
|
|
206
|
+
} else {
|
|
207
|
+
if (process.env.GLOBAL_AGENT_NO_PROXY) {
|
|
208
|
+
delete process.env.GLOBAL_AGENT_NO_PROXY
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
bootstrap();
|
|
213
|
+
|
|
214
|
+
console.log("process.env", process.env)
|
|
215
|
+
|
|
184
216
|
// ORDERING MATTERS.
|
|
185
217
|
// General purpose package managers like conda, conda needs to come at the end
|
|
186
218
|
|
|
@@ -309,15 +341,15 @@ class Bin {
|
|
|
309
341
|
// Use sqlite to check if `conda update -y --all` went through successfully
|
|
310
342
|
// sometimes it just fails silently so need to check
|
|
311
343
|
if (name === "sqlite") {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
344
|
+
let coerced = semver.coerce(version)
|
|
345
|
+
let sqlite_requirement = ">=3.47.2"
|
|
346
|
+
// console.log({ coerced, version, sqlite_requirement })
|
|
347
|
+
if (semver.satisfies(coerced, sqlite_requirement)) {
|
|
348
|
+
console.log("semver satisfied")
|
|
349
|
+
|
|
318
350
|
conda_check.sqlite = true
|
|
319
351
|
} else {
|
|
320
|
-
console.log("
|
|
352
|
+
console.log("semver NOT satisfied")
|
|
321
353
|
}
|
|
322
354
|
}
|
|
323
355
|
}
|
package/kernel/environment.js
CHANGED
|
@@ -400,6 +400,12 @@ const get2 = async (filepath, kernel) => {
|
|
|
400
400
|
let api_env = await get(api_path)
|
|
401
401
|
let process_env = kernel.envs || process.env
|
|
402
402
|
let current_env = Object.assign({}, process_env, default_env, api_env)
|
|
403
|
+
for(let key in current_env) {
|
|
404
|
+
let val = current_env[key]
|
|
405
|
+
if (typeof val === 'String' && val.trim() === "") {
|
|
406
|
+
delete current_env[key]
|
|
407
|
+
}
|
|
408
|
+
}
|
|
403
409
|
return current_env
|
|
404
410
|
}
|
|
405
411
|
|
package/kernel/index.js
CHANGED
|
@@ -234,9 +234,14 @@ class Kernel {
|
|
|
234
234
|
async wait(options) {
|
|
235
235
|
await waitOn(options)
|
|
236
236
|
}
|
|
237
|
-
async getInfo(){
|
|
237
|
+
async getInfo(refresh){
|
|
238
238
|
let info = this.sysinfo
|
|
239
|
-
|
|
239
|
+
console.time(">>>>> updateSysinfo")
|
|
240
|
+
console.log("refresh", refresh)
|
|
241
|
+
if (refresh) {
|
|
242
|
+
await this.update_sysinfo()
|
|
243
|
+
}
|
|
244
|
+
console.timeEnd(">>>>> updateSysinfo")
|
|
240
245
|
let i = {
|
|
241
246
|
version: this.version,
|
|
242
247
|
platform: this.platform,
|
|
@@ -599,68 +604,10 @@ class Kernel {
|
|
|
599
604
|
|
|
600
605
|
await fs.promises.mkdir(this.path("logs"), { recursive: true }).catch((e) => { })
|
|
601
606
|
await fs.promises.writeFile(this.path("logs/system.json"), JSON.stringify(this.i, null, 2))
|
|
602
|
-
|
|
603
|
-
/*
|
|
604
|
-
this.sys = new Sysinfo()
|
|
605
|
-
await this.sys.init(this)
|
|
606
|
-
let info = this.sys.info
|
|
607
|
-
await fs.promises.mkdir(this.path("logs"), { recursive: true }).catch((e) => { })
|
|
608
|
-
await fs.promises.writeFile(this.path("logs/system.json"), JSON.stringify({
|
|
609
|
-
platform: this.platform,
|
|
610
|
-
arch: this.arch,
|
|
611
|
-
home: this.homedir,
|
|
612
|
-
...info
|
|
613
|
-
}, null, 2))
|
|
614
|
-
this.sysinfo = info
|
|
615
|
-
console.time("template.init")
|
|
616
|
-
await this.template.init({
|
|
617
|
-
kernel: this,
|
|
618
|
-
system,
|
|
619
|
-
platform: this.platform,
|
|
620
|
-
arch: this.arch,
|
|
621
|
-
proxy: (port) => {
|
|
622
|
-
return this.api.get_proxy_url("/proxy", port)
|
|
623
|
-
},
|
|
624
|
-
...info
|
|
625
|
-
})
|
|
626
|
-
console.timeEnd("template.init")
|
|
627
|
-
console.time("update_sysinfo")
|
|
628
|
-
await this.update_sysinfo()
|
|
629
|
-
console.timeEnd("update_sysinfo")
|
|
630
|
-
*/
|
|
631
|
-
// console.log("> 4")
|
|
632
|
-
// this.shell.init().then(() => {
|
|
633
|
-
// if (this.envs) {
|
|
634
|
-
// this.template.update({
|
|
635
|
-
// env: this.envs,
|
|
636
|
-
// envs: this.envs
|
|
637
|
-
// })
|
|
638
|
-
// }
|
|
639
|
-
// })
|
|
640
|
-
//await this.shell.init()
|
|
641
607
|
}
|
|
642
608
|
|
|
643
|
-
//let pwpath = this.bin.path("playwright/js/node_modules/playwright")
|
|
644
609
|
let pwpath = this.bin.path("playwright/node_modules/playwright")
|
|
645
610
|
this.playwright = (await this.loader.load(pwpath)).resolved
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
// let pwpath
|
|
649
|
-
// if (this.platform === "win32") {
|
|
650
|
-
// pwpath = this.bin.path("miniconda/node_modules/playwright")
|
|
651
|
-
// } else {
|
|
652
|
-
// pwpath = this.bin.path("miniconda/lib/node_modules/playwright")
|
|
653
|
-
// }
|
|
654
|
-
|
|
655
|
-
// await this.template.init()
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
// let PuppeteerPath = this.bin.path("puppet", "node_modules", "puppeteer")
|
|
659
|
-
// this.puppet = (await this.loader.load(PuppeteerPath)).resolved
|
|
660
|
-
// this.puppet.setGlobalOptions({
|
|
661
|
-
// userDataDir: this.bin.path("puppet")
|
|
662
|
-
// });
|
|
663
|
-
|
|
664
611
|
} catch (e) {
|
|
665
612
|
console.log("### ERROR", e)
|
|
666
613
|
}
|
|
@@ -676,7 +623,6 @@ class Kernel {
|
|
|
676
623
|
try {
|
|
677
624
|
await this.sys.refresh()
|
|
678
625
|
let info = this.sys.info
|
|
679
|
-
console.log({ info })
|
|
680
626
|
this.template.update(info)
|
|
681
627
|
this.sysinfo = info
|
|
682
628
|
this.gpu = info.gpu
|
package/kernel/sysinfo.js
CHANGED
package/kernel/util.js
CHANGED
|
@@ -200,6 +200,7 @@ const escapeStringRegexp = (string) => {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
const update_env = async (filepath, changes) => {
|
|
203
|
+
console.log("UPDATE_ENV", { filepath, changes })
|
|
203
204
|
const env = await fs.promises.readFile(filepath, "utf8")
|
|
204
205
|
let append = false;
|
|
205
206
|
const newval = Object.keys(changes).reduce((result, varname) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinokiod",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.35",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"fs-extra": "^11.1.1",
|
|
32
32
|
"glob": "^10.3.3",
|
|
33
33
|
"glob-gitignore": "^1.0.14",
|
|
34
|
+
"global-agent": "^3.0.0",
|
|
34
35
|
"go-get-folder-size": "^0.5.5",
|
|
35
36
|
"http-proxy": "^1.18.1",
|
|
36
37
|
"http-proxy-middleware": "^3.0.0",
|
package/server/index.js
CHANGED
|
@@ -75,6 +75,7 @@ class Server {
|
|
|
75
75
|
process.env.WEBKIT_DISABLE_DMABUF_RENDERER = 1
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
|
|
78
79
|
// process.env.CONDA_LIBMAMBA_SOLVER_DEBUG_LIBSOLV = 1
|
|
79
80
|
}
|
|
80
81
|
stop() {
|
|
@@ -572,6 +573,10 @@ class Server {
|
|
|
572
573
|
query: req.query
|
|
573
574
|
})
|
|
574
575
|
} else if (pathComponents.length === 0 && req.query.mode === "settings") {
|
|
576
|
+
let system_env = {}
|
|
577
|
+
if (this.kernel.homedir) {
|
|
578
|
+
system_env = await Environment.get(this.kernel.homedir)
|
|
579
|
+
}
|
|
575
580
|
let configArray = [{
|
|
576
581
|
key: "home",
|
|
577
582
|
description: [
|
|
@@ -588,6 +593,21 @@ class Server {
|
|
|
588
593
|
key: "theme",
|
|
589
594
|
val: this.theme,
|
|
590
595
|
options: ["light", "dark"]
|
|
596
|
+
}, {
|
|
597
|
+
key: "HTTP_PROXY",
|
|
598
|
+
val: (system_env.HTTP_PROXY || ""),
|
|
599
|
+
show_on_click: "#proxy",
|
|
600
|
+
placeholder: "(Advanced) Only set if you are behind a proxy"
|
|
601
|
+
}, {
|
|
602
|
+
key: "HTTPS_PROXY",
|
|
603
|
+
val: (system_env.HTTPS_PROXY || ""),
|
|
604
|
+
show_on_click: "#proxy",
|
|
605
|
+
placeholder: "(Advanced) Only set if you are behind a proxy"
|
|
606
|
+
}, {
|
|
607
|
+
key: "NO_PROXY",
|
|
608
|
+
val: (system_env.NO_PROXY || ""),
|
|
609
|
+
show_on_click: "#proxy",
|
|
610
|
+
placeholder: "(Advanced) Only set if you are behind a proxy"
|
|
591
611
|
}]
|
|
592
612
|
let folders = {}
|
|
593
613
|
if (this.kernel.homedir) {
|
|
@@ -597,6 +617,7 @@ class Server {
|
|
|
597
617
|
drive: path.resolve(this.kernel.homedir, "drive"),
|
|
598
618
|
}
|
|
599
619
|
}
|
|
620
|
+
console.log({ configArray })
|
|
600
621
|
res.render("settings", {
|
|
601
622
|
platform,
|
|
602
623
|
version: this.version,
|
|
@@ -2018,6 +2039,27 @@ class Server {
|
|
|
2018
2039
|
home = this.kernel.store.get("home")
|
|
2019
2040
|
theme = this.kernel.store.get("theme")
|
|
2020
2041
|
let new_home = this.kernel.store.get("new_home")
|
|
2042
|
+
|
|
2043
|
+
// Handle environment variables
|
|
2044
|
+
// HTTP_PROXY
|
|
2045
|
+
// HTTPS_PROXY
|
|
2046
|
+
// const updated = { }
|
|
2047
|
+
// if (config.HTTP_PROXY) {
|
|
2048
|
+
// updated.HTTP_PROXY = config.HTTP_PROXY
|
|
2049
|
+
// }
|
|
2050
|
+
// if (config.HTTPS_PROXY) {
|
|
2051
|
+
// updated.HTTPS_PROXY = config.HTTPS_PROXY
|
|
2052
|
+
// }
|
|
2053
|
+
if (this.kernel.homedir) {
|
|
2054
|
+
const updated = {
|
|
2055
|
+
HTTP_PROXY: config.HTTP_PROXY,
|
|
2056
|
+
HTTPS_PROXY: config.HTTPS_PROXY,
|
|
2057
|
+
NO_PROXY: config.NO_PROXY,
|
|
2058
|
+
}
|
|
2059
|
+
let fullpath = path.resolve(this.kernel.homedir, "ENVIRONMENT")
|
|
2060
|
+
console.log({ updated })
|
|
2061
|
+
await Util.update_env(fullpath, updated)
|
|
2062
|
+
}
|
|
2021
2063
|
}
|
|
2022
2064
|
async startLogging(homedir) {
|
|
2023
2065
|
console.log(">>>>>>> startLogging", homedir)
|
|
@@ -2329,6 +2371,10 @@ class Server {
|
|
|
2329
2371
|
} else {
|
|
2330
2372
|
_home = path.resolve(os.homedir(), "pinokio")
|
|
2331
2373
|
}
|
|
2374
|
+
let system_env = {}
|
|
2375
|
+
if (this.kernel.homedir) {
|
|
2376
|
+
system_env = await Environment.get(this.kernel.homedir)
|
|
2377
|
+
}
|
|
2332
2378
|
let configArray = [{
|
|
2333
2379
|
key: "home",
|
|
2334
2380
|
description: [
|
|
@@ -2346,6 +2392,21 @@ class Server {
|
|
|
2346
2392
|
key: "theme",
|
|
2347
2393
|
val: this.theme,
|
|
2348
2394
|
options: ["light", "dark"]
|
|
2395
|
+
}, {
|
|
2396
|
+
key: "HTTP_PROXY",
|
|
2397
|
+
val: (system_env.HTTP_PROXY || ""),
|
|
2398
|
+
show_on_click: "#proxy",
|
|
2399
|
+
placeholder: "(Advanced) Only set if you are behind a proxy"
|
|
2400
|
+
}, {
|
|
2401
|
+
key: "HTTPS_PROXY",
|
|
2402
|
+
val: (system_env.HTTPS_PROXY || ""),
|
|
2403
|
+
show_on_click: "#proxy",
|
|
2404
|
+
placeholder: "(Advanced) Only set if you are behind a proxy"
|
|
2405
|
+
}, {
|
|
2406
|
+
key: "NO_PROXY",
|
|
2407
|
+
val: (system_env.NO_PROXY || ""),
|
|
2408
|
+
show_on_click: "#proxy",
|
|
2409
|
+
placeholder: "(Advanced) Only set if you are behind a proxy"
|
|
2349
2410
|
}]
|
|
2350
2411
|
let folders = {}
|
|
2351
2412
|
if (this.kernel.homedir) {
|
|
@@ -3137,7 +3198,7 @@ class Server {
|
|
|
3137
3198
|
res.json({ success: true })
|
|
3138
3199
|
}))
|
|
3139
3200
|
this.app.get("/pinokio/info", ex(async (req, res) => {
|
|
3140
|
-
await this.kernel.getInfo()
|
|
3201
|
+
await this.kernel.getInfo(true)
|
|
3141
3202
|
let info = Object.assign({}, this.kernel.i)
|
|
3142
3203
|
info.launch_complete = this.kernel.launch_complete
|
|
3143
3204
|
console.log("kernel.launch_complete", this.kernel.launch_complete)
|
|
@@ -3391,7 +3452,6 @@ class Server {
|
|
|
3391
3452
|
this.start({ debug: this.debug, browser: this.browser })
|
|
3392
3453
|
}))
|
|
3393
3454
|
this.app.post("/config", ex(async (req, res) => {
|
|
3394
|
-
console.log("/config", { body: req.body })
|
|
3395
3455
|
try {
|
|
3396
3456
|
await this.setConfig(req.body)
|
|
3397
3457
|
res.json({ success: true })
|
package/server/socket.js
CHANGED
|
@@ -194,6 +194,12 @@ hr {
|
|
|
194
194
|
margin-bottom: 10px;
|
|
195
195
|
text-align: center;
|
|
196
196
|
}
|
|
197
|
+
#proxy {
|
|
198
|
+
text-decoration: underline;
|
|
199
|
+
margin-left: 10px;
|
|
200
|
+
display: inline-block;
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
}
|
|
197
203
|
</style>
|
|
198
204
|
<script src="/hotkeys.min.js"></script>
|
|
199
205
|
<script src="/sweetalert2.js"></script>
|
|
@@ -266,7 +272,7 @@ hr {
|
|
|
266
272
|
</div>
|
|
267
273
|
<form>
|
|
268
274
|
<% config.forEach((c) => { %>
|
|
269
|
-
<div class='item'
|
|
275
|
+
<div class='item <%=c.show_on_click ? "hidden" : ""%>' <%=c.show_on_click ? "data-onclick=" + c.show_on_click : ""%>>
|
|
270
276
|
<label><%=c.key%></label>
|
|
271
277
|
<% if (c.options) { %>
|
|
272
278
|
<select name="<%=c.key%>">
|
|
@@ -298,6 +304,7 @@ hr {
|
|
|
298
304
|
<% }) %>
|
|
299
305
|
<br>
|
|
300
306
|
<button id='save' class='btn disabled'>Save</button>
|
|
307
|
+
<a id='proxy'>Running behind proxy?</a>
|
|
301
308
|
</form>
|
|
302
309
|
<div class='loading hidden'>
|
|
303
310
|
<i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
|
|
@@ -485,6 +492,11 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
485
492
|
// let sep = "<%=platform === 'win32' ? '\\' : '/'%>"
|
|
486
493
|
// document.querySelector("[name=drive]").value = e.target.value + sep + "drive"
|
|
487
494
|
// })
|
|
495
|
+
document.querySelector("#proxy").addEventListener("click", (e) => {
|
|
496
|
+
document.querySelectorAll("[data-onclick='#proxy']").forEach((el) => {
|
|
497
|
+
el.classList.remove("hidden")
|
|
498
|
+
})
|
|
499
|
+
})
|
|
488
500
|
document.querySelector("#back").addEventListener("click", (e) => {
|
|
489
501
|
history.back()
|
|
490
502
|
})
|
|
@@ -523,6 +535,11 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
523
535
|
document.querySelector("[name=home]").focus()
|
|
524
536
|
return
|
|
525
537
|
}
|
|
538
|
+
if (val.length === 0) {
|
|
539
|
+
alert("Please set the home path")
|
|
540
|
+
document.querySelector("[name=home]").focus()
|
|
541
|
+
return
|
|
542
|
+
}
|
|
526
543
|
|
|
527
544
|
// let drive = document.querySelector(`[name=drive]`).value
|
|
528
545
|
// if (/.*\s+.*/.test(drive)) {
|
|
@@ -536,15 +553,30 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
536
553
|
document.querySelector("#save").classList.add("hidden")
|
|
537
554
|
document.querySelector("[name=home]").setAttribute("disabled", "disabled")
|
|
538
555
|
// document.querySelector("[name=drive]").setAttribute("disabled", "disabled")
|
|
539
|
-
let theme = document.querySelector(`[name=theme]`).value
|
|
556
|
+
// let theme = document.querySelector(`[name=theme]`).value
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
let body = {}
|
|
560
|
+
let els = document.querySelectorAll(".item [name]")
|
|
561
|
+
for(let el of els) {
|
|
562
|
+
let name = el.getAttribute("name")
|
|
563
|
+
// if (el.value && el.value.length > 0) {
|
|
564
|
+
body[name] = el.value
|
|
565
|
+
// }
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
console.log("body", body)
|
|
569
|
+
|
|
570
|
+
|
|
540
571
|
let r = await fetch("/config", {
|
|
541
572
|
method: "post",
|
|
542
573
|
headers: { "Content-Type": "application/json" },
|
|
543
|
-
body: JSON.stringify(
|
|
544
|
-
|
|
545
|
-
//
|
|
546
|
-
|
|
547
|
-
|
|
574
|
+
body: JSON.stringify(body)
|
|
575
|
+
// body: JSON.stringify({
|
|
576
|
+
// home: (val && val.length > 0 ? val : null),
|
|
577
|
+
//// drive: (drive && drive.length > 0 ? drive : null),
|
|
578
|
+
// theme
|
|
579
|
+
// })
|
|
548
580
|
}).then((res) => {
|
|
549
581
|
return res.json()
|
|
550
582
|
})
|