pinokiod 1.3.99 → 2.0.1
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/cloudflare/index.js +0 -2
- package/kernel/environment.js +3 -3
- package/kernel/util.js +0 -2
- package/package.json +1 -1
- package/script/index.js +3 -1
- package/server/index.js +0 -1
package/kernel/environment.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
|
+
const os = require('os')
|
|
2
3
|
const fs = require('fs')
|
|
3
4
|
const Util = require('./util')
|
|
5
|
+
const platform = os.platform()
|
|
4
6
|
const ENVS = [{
|
|
5
7
|
type: ["system"],
|
|
6
8
|
key: "HOMEBREW_CACHE",
|
|
@@ -163,7 +165,7 @@ const ENVS = [{
|
|
|
163
165
|
}, {
|
|
164
166
|
type: ["system"],
|
|
165
167
|
key: "PINOKIO_PORT",
|
|
166
|
-
val: "80",
|
|
168
|
+
val: (platform === "linux" ? "42000" : "80"),
|
|
167
169
|
comment: [
|
|
168
170
|
"##########################################################################",
|
|
169
171
|
"#",
|
|
@@ -293,11 +295,9 @@ const init_folders = async (homedir) => {
|
|
|
293
295
|
|
|
294
296
|
// Get the actual environment variable at specific path
|
|
295
297
|
const get2 = async (filepath, kernel) => {
|
|
296
|
-
console.log("Get2")
|
|
297
298
|
let api_path = Util.api_path(filepath, kernel)
|
|
298
299
|
let default_env = await get(kernel.homedir)
|
|
299
300
|
let api_env = await get(api_path)
|
|
300
|
-
console.log({ api_path, default_env, api_env, process_env: process.env })
|
|
301
301
|
let current_env = Object.assign({}, process.env, default_env, api_env)
|
|
302
302
|
return current_env
|
|
303
303
|
}
|
package/kernel/util.js
CHANGED
|
@@ -87,7 +87,6 @@ const escapeStringRegexp = (string) => {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
const update_env = async (filepath, changes) => {
|
|
90
|
-
console.log("update_env", { filepath, changes })
|
|
91
90
|
const env = await fs.promises.readFile(filepath, "utf8")
|
|
92
91
|
let append = false;
|
|
93
92
|
const newval = Object.keys(changes).reduce((result, varname) => {
|
|
@@ -96,7 +95,6 @@ const update_env = async (filepath, changes) => {
|
|
|
96
95
|
.replace(returnPattern, returnReplacement)
|
|
97
96
|
.trim();
|
|
98
97
|
const safeName = escapeStringRegexp(varname);
|
|
99
|
-
console.log({ value, safeName, result, varname })
|
|
100
98
|
const varPattern = new RegExp(`^(${h}*${safeName}${h}*=${h}*)\\S*(${h}*)$`, "gm");
|
|
101
99
|
if (varPattern.test(result)) {
|
|
102
100
|
const safeValue = value.replace(groupPattern, groupReplacement);
|
package/package.json
CHANGED
package/script/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const fs = require('fs')
|
|
3
|
+
const os = require('os')
|
|
4
|
+
const platform = os.platform()
|
|
3
5
|
const Server = require('../server')
|
|
4
6
|
class Store {
|
|
5
7
|
set(key, val) {
|
|
@@ -36,7 +38,7 @@ class Store {
|
|
|
36
38
|
}
|
|
37
39
|
const server = new Server({
|
|
38
40
|
//port: 42000,
|
|
39
|
-
port: 80,
|
|
41
|
+
port: (platform === "linux" ? 42000 : 80),
|
|
40
42
|
agent: "web",
|
|
41
43
|
store: new Store()
|
|
42
44
|
})
|
package/server/index.js
CHANGED
|
@@ -1993,7 +1993,6 @@ class Server {
|
|
|
1993
1993
|
//let home = this.kernel.homedir
|
|
1994
1994
|
let home = this.kernel.store.get("home")
|
|
1995
1995
|
this.app.get("/", async (req, res) => {
|
|
1996
|
-
console.log("req", req)
|
|
1997
1996
|
if (req.query.mode !== "settings" && !home) {
|
|
1998
1997
|
res.redirect("/?mode=settings")
|
|
1999
1998
|
return
|