@oddessentials/agent-guild 0.26.0 → 0.27.0
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/README.md +3 -3
- package/bin/agent-guild.mjs +2 -2
- package/node_modules/qrcode-generator/README.md +101 -0
- package/node_modules/qrcode-generator/dist/qrcode.d.ts +57 -0
- package/node_modules/qrcode-generator/dist/qrcode.js +2297 -0
- package/node_modules/qrcode-generator/dist/qrcode.mjs +2237 -0
- package/node_modules/qrcode-generator/dist/qrcode_SJIS.js +30 -0
- package/node_modules/qrcode-generator/dist/qrcode_SJIS.mjs +23 -0
- package/node_modules/qrcode-generator/dist/qrcode_UTF8.js +26 -0
- package/node_modules/qrcode-generator/dist/qrcode_UTF8.mjs +50 -0
- package/node_modules/qrcode-generator/experiment/vt/package-lock.json +6184 -0
- package/node_modules/qrcode-generator/experiment/vt/package.json +19 -0
- package/node_modules/qrcode-generator/experiment/vt/src/main/qrcode.ts +2311 -0
- package/node_modules/qrcode-generator/experiment/vt/src/main/qrcode_SJIS.ts +25 -0
- package/node_modules/qrcode-generator/experiment/vt/src/main/qrcode_UTF8.ts +50 -0
- package/node_modules/qrcode-generator/experiment/vt/src/main/types.ts +80 -0
- package/node_modules/qrcode-generator/experiment/vt/src/test/qrcode-test-impl.js +353 -0
- package/node_modules/qrcode-generator/experiment/vt/src/test/qrcode.test.mjs +5 -0
- package/node_modules/qrcode-generator/experiment/vt/src/test/qrcode_SJIS.test.mjs +10 -0
- package/node_modules/qrcode-generator/experiment/vt/src/test/qrcode_UTF8.test.mjs +9 -0
- package/node_modules/qrcode-generator/experiment/vt/tsconfig.json +25 -0
- package/node_modules/qrcode-generator/experiment/vt/vite.config.js +31 -0
- package/node_modules/qrcode-generator/experiment/vt/web-test-runner.config.mjs +7 -0
- package/node_modules/qrcode-generator/package.json +37 -0
- package/node_modules/qrcode-generator/test/qrcode-test-impl.js +353 -0
- package/node_modules/qrcode-generator/test/qrcode.test.html +18 -0
- package/node_modules/qrcode-generator/test/qrcode.test.mjs +5 -0
- package/node_modules/qrcode-generator/test/qrcode_SJIS.test.html +21 -0
- package/node_modules/qrcode-generator/test/qrcode_SJIS.test.mjs +10 -0
- package/node_modules/qrcode-generator/test/qrcode_UTF8.test.html +19 -0
- package/node_modules/qrcode-generator/test/qrcode_UTF8.test.mjs +9 -0
- package/node_modules/qrcode-generator/web-test-runner.config.mjs +8 -0
- package/package.json +2 -1
- package/src/manager/access-policy.mjs +39 -0
- package/src/manager/config.mjs +1 -0
- package/src/manager/main.mjs +11 -9
- package/src/manager/remote-access.mjs +286 -0
- package/src/manager/server.mjs +45 -27
- package/src/manager/tailscale.mjs +201 -0
- package/web/app.js +18 -4
- package/web/index.html +65 -0
- package/web/remote-access.js +236 -0
- package/web/styles.css +23 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"erasableSyntaxOnly": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["src"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { dirname, resolve } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
import dts from 'vite-plugin-dts';
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
build: {
|
|
10
|
+
outDir: 'dist',
|
|
11
|
+
sourcemap: true,
|
|
12
|
+
lib: {
|
|
13
|
+
entry: [
|
|
14
|
+
resolve(__dirname, 'src/main/qrcode.ts'),
|
|
15
|
+
resolve(__dirname, 'src/main/qrcode_SJIS.ts'),
|
|
16
|
+
resolve(__dirname, 'src/main/qrcode_UTF8.ts')
|
|
17
|
+
],
|
|
18
|
+
fileName: (format, entryName) =>
|
|
19
|
+
format == 'cjs'? `${entryName}.js` :
|
|
20
|
+
format == 'es'? `${entryName}.mjs` :
|
|
21
|
+
`${entryName}.${format}.js`,
|
|
22
|
+
formats: ['cjs', 'es'],
|
|
23
|
+
},
|
|
24
|
+
rollupOptions : { output : { exports : 'named' } }
|
|
25
|
+
},
|
|
26
|
+
plugins: [
|
|
27
|
+
dts({
|
|
28
|
+
rollupTypes : true,
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qrcode-generator",
|
|
3
|
+
"version": "2.0.4",
|
|
4
|
+
"description": "QR Code Generator implementation in JavaScript.",
|
|
5
|
+
"author": "Kazuhiko Arase",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/qrcode.js",
|
|
8
|
+
"module": "dist/qrcode.mjs",
|
|
9
|
+
"types": "dist/qrcode.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"types": "./dist/qrcode.d.ts",
|
|
12
|
+
"require": "./dist/qrcode.js",
|
|
13
|
+
"import": "./dist/qrcode.mjs"
|
|
14
|
+
},
|
|
15
|
+
"directories": {
|
|
16
|
+
"dist": "dist"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/kazuhikoarase/qrcode-generator.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/kazuhikoarase/qrcode-generator/issues"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"qr",
|
|
27
|
+
"qrcode",
|
|
28
|
+
"generator"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "wtr"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@open-wc/testing": "^4.0.0",
|
|
35
|
+
"@web/test-runner": "^0.20.2"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { expect } from "@open-wc/testing";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const limit = 80;
|
|
5
|
+
const debug = false;
|
|
6
|
+
|
|
7
|
+
export const capture = function(varName, s) {
|
|
8
|
+
let code = '';
|
|
9
|
+
const println = function(s) { code += s + '\n'; };
|
|
10
|
+
let line = s;
|
|
11
|
+
println('let ' + varName + ' = \'\';');
|
|
12
|
+
while (line.length > limit) {
|
|
13
|
+
println(varName + ' += \'' + line.substring(0, limit) + '\';');
|
|
14
|
+
line = line.substring(limit);
|
|
15
|
+
}
|
|
16
|
+
if (line.length > 0) {
|
|
17
|
+
println(varName + ' += \'' + line + '\';');
|
|
18
|
+
}
|
|
19
|
+
if (debug) {
|
|
20
|
+
console.log(code);
|
|
21
|
+
}
|
|
22
|
+
return s;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const overview = function(qrcode) {
|
|
26
|
+
|
|
27
|
+
describe('QRCode', function(){
|
|
28
|
+
it('should exist', function(){
|
|
29
|
+
expect(!!qrcode).to.be.true;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should be a callable function', function(){
|
|
33
|
+
expect(qrcode instanceof Function).to.be.true;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should generate correct GIF image tag', function(){
|
|
37
|
+
var sourceText = 'http://www.example.com/ążśźęćńół';
|
|
38
|
+
var correctImgTag = '<img src="data:image/gif;base64,R0lGODdhSgBKAIAAAAAAAP///ywAAAAASgBKAAAC/4yPqcvtD6OctNqLs968+w+G4kiWZgKk6roa7ZEiccACco1TeE6r9997uXYsna0xmw0VLyXsyHBCpKijk9qEPh1UrrXYAy4Xu3FtLEmCr9pucP3NGofyN9peBZ7DE3W9Tqd15+fDlxZXiPVlltiGqDb3BpnHRzj4uNgnSHkjZCiZGbXpRVrlyQZINopE9Jc5CdtaeCj7asvIWEvimet4oqkYKDZiCSrMWtobmcW8esfki2exN4XY2cj7aZQtehxIGHwR+41dDg3tdogLCm7N+ZTOOom+irqZGk//DF/vqDiv7cEpTMW4CZxVYSC5gghpOTt46dg4PGxE5aNUkeItje3Drm3zh9DewIytPl7LuBCkHiImpbEjaAvlloTm+DVzJXNftZM89lAz5vLiOZs94YysqZNmtZ8/vQiFeJApmKUPu30qU6mhKola1V0t6g2ZxqcaAK4biraE2axW004LyeNs1loGHfIkGY3uVLV7Ge4rSayvu7WAHQIGGMvn4KqqdLGd2S5xKE2lit2dfIlswJVhU/5VSRmoyEbr9NbdKhqkq156l8GJCFQZ0aRWFcOWGtZ2aN2IN3LlvPv149Kg8UZqi5ElP+JvkyXH+ns4MFnR/+0F/vEw6YDQk//6Dj68+PHky5s/jz69+vULCgAAOw==" width="74" height="74"/>';
|
|
39
|
+
|
|
40
|
+
var qr = qrcode(-1, 'M');
|
|
41
|
+
qr.addData(unescape(encodeURI(sourceText)));
|
|
42
|
+
qr.make();
|
|
43
|
+
|
|
44
|
+
expect(qr.createImgTag() ).to.equal(correctImgTag);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should generate correct GIF image data', function(){
|
|
48
|
+
var sourceText = 'http://www.example.com/ążśźęćńół';
|
|
49
|
+
var correctImgData = 'R0lGODdhSgBKAIAAAAAAAP///ywAAAAASgBKAAAC/4yPqcvtD6OctNqLs968+w+G4kiWZgKk6roa7ZEiccACco1TeE6r9997uXYsna0xmw0VLyXsyHBCpKijk9qEPh1UrrXYAy4Xu3FtLEmCr9pucP3NGofyN9peBZ7DE3W9Tqd15+fDlxZXiPVlltiGqDb3BpnHRzj4uNgnSHkjZCiZGbXpRVrlyQZINopE9Jc5CdtaeCj7asvIWEvimet4oqkYKDZiCSrMWtobmcW8esfki2exN4XY2cj7aZQtehxIGHwR+41dDg3tdogLCm7N+ZTOOom+irqZGk//DF/vqDiv7cEpTMW4CZxVYSC5gghpOTt46dg4PGxE5aNUkeItje3Drm3zh9DewIytPl7LuBCkHiImpbEjaAvlloTm+DVzJXNftZM89lAz5vLiOZs94YysqZNmtZ8/vQiFeJApmKUPu30qU6mhKola1V0t6g2ZxqcaAK4biraE2axW004LyeNs1loGHfIkGY3uVLV7Ge4rSayvu7WAHQIGGMvn4KqqdLGd2S5xKE2lit2dfIlswJVhU/5VSRmoyEbr9NbdKhqkq156l8GJCFQZ0aRWFcOWGtZ2aN2IN3LlvPv149Kg8UZqi5ElP+JvkyXH+ns4MFnR/+0F/vEw6YDQk//6Dj68+PHky5s/jz69+vULCgAAOw==';
|
|
50
|
+
|
|
51
|
+
var qr = qrcode(-1, 'M');
|
|
52
|
+
qr.addData(unescape(encodeURI(sourceText)));
|
|
53
|
+
qr.make();
|
|
54
|
+
|
|
55
|
+
var data = qr.createDataURL().replace('data:image/gif;base64,', '');
|
|
56
|
+
|
|
57
|
+
expect(btoa(atob(data) ) ).to.equal(correctImgData);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should generate correct UTF8 text data', function(){
|
|
61
|
+
var sourceText = 'http://www.example.com/ążśźęćńół';
|
|
62
|
+
var correctTextData1 = [
|
|
63
|
+
'█████████████████████████████████',
|
|
64
|
+
'██ ▄▄▄▄▄ █ ▄█▀▄██ ▀▄ ▄██ ▄▄▄▄▄ ██',
|
|
65
|
+
'██ █ █ █▀ █▀▄█▀▀█▄▄ ▄█ █ █ ██',
|
|
66
|
+
'██ █▄▄▄█ ███ ▀ █▄▀▄▄▀ ▀█ █▄▄▄█ ██',
|
|
67
|
+
'██▄▄▄▄▄▄▄█ ▀▄█▄▀▄▀ █▄▀▄█▄▄▄▄▄▄▄██',
|
|
68
|
+
'██▄█ ▀▄▄▄█▄▄█▀█▀▀▄█▀▀▀█ ▀▀▄█▄ ██',
|
|
69
|
+
'██▀▀▄▀▄█▄█ ▄▄█▄ ▄█ ███ ▀█▀▄▄▀██',
|
|
70
|
+
'██ ▄▀█▄▀▄ ▄▀▄ █ ▄▀▀█▀██▀██▄▄▀▀██',
|
|
71
|
+
'██ █▀ ▄▄▀▀ ▀█ █▀▄ ▀█▄▀▄▄▄ ▄██',
|
|
72
|
+
'██▄██ ▄▄▄▄▄█ ▀▄▄ ▀▀▄▄▄█▄▄█▀ ███',
|
|
73
|
+
'██▄█▄██▄▄▄ █ █▄▄▀█▀███▄▀▄▄█▄ ████',
|
|
74
|
+
'███▄▄██▄▄▄ ▀▀▄█ █▀ █ ▄ ▄▄▄ ▀▀██',
|
|
75
|
+
'██ ▄▄▄▄▄ █ █ ▀█▄█ ▀ ▄ █▄█ ▄█ ▀██',
|
|
76
|
+
'██ █ █ █▀▄▄ ▄▀ ▀▄█ █ ▄▄ ▄ ██',
|
|
77
|
+
'██ █▄▄▄█ █▄█▄▀█ ▀ ▀ ██ █ █▀▄▀▄██',
|
|
78
|
+
'██▄▄▄▄▄▄▄█▄▄█▄█▄███▄▄▄▄████▄█▄███',
|
|
79
|
+
'▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀'].join('\n');
|
|
80
|
+
|
|
81
|
+
var correctTextData2 = [
|
|
82
|
+
' ▄▄▄▄▄ █ ▄█▀▄██ ▀▄ ▄██ ▄▄▄▄▄ ',
|
|
83
|
+
' █ █ █▀ █▀▄█▀▀█▄▄ ▄█ █ █ ',
|
|
84
|
+
' █▄▄▄█ ███ ▀ █▄▀▄▄▀ ▀█ █▄▄▄█ ',
|
|
85
|
+
'▄▄▄▄▄▄▄█ ▀▄█▄▀▄▀ █▄▀▄█▄▄▄▄▄▄▄',
|
|
86
|
+
'▄█ ▀▄▄▄█▄▄█▀█▀▀▄█▀▀▀█ ▀▀▄█▄ ',
|
|
87
|
+
'▀▀▄▀▄█▄█ ▄▄█▄ ▄█ ███ ▀█▀▄▄▀',
|
|
88
|
+
' ▄▀█▄▀▄ ▄▀▄ █ ▄▀▀█▀██▀██▄▄▀▀',
|
|
89
|
+
' █▀ ▄▄▀▀ ▀█ █▀▄ ▀█▄▀▄▄▄ ▄',
|
|
90
|
+
'▄██ ▄▄▄▄▄█ ▀▄▄ ▀▀▄▄▄█▄▄█▀ █',
|
|
91
|
+
'▄█▄██▄▄▄ █ █▄▄▀█▀███▄▀▄▄█▄ ██',
|
|
92
|
+
'█▄▄██▄▄▄ ▀▀▄█ █▀ █ ▄ ▄▄▄ ▀▀',
|
|
93
|
+
' ▄▄▄▄▄ █ █ ▀█▄█ ▀ ▄ █▄█ ▄█ ▀',
|
|
94
|
+
' █ █ █▀▄▄ ▄▀ ▀▄█ █ ▄▄ ▄ ',
|
|
95
|
+
' █▄▄▄█ █▄█▄▀█ ▀ ▀ ██ █ █▀▄▀▄',
|
|
96
|
+
' ▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀ ▀'].join('\n');
|
|
97
|
+
|
|
98
|
+
var correctTextData3 = [
|
|
99
|
+
'██████████████████████████████████████████████████████████████████',
|
|
100
|
+
'██████████████████████████████████████████████████████████████████',
|
|
101
|
+
'████ ██ ████ ████ ██ ████ ████',
|
|
102
|
+
'████ ██████████ ██ ████ ██████ ██ ██████ ██████████ ████',
|
|
103
|
+
'████ ██ ██ ████ ████ ████████ ██ ██ ██ ████',
|
|
104
|
+
'████ ██ ██ ██ ██ ████ ██████ ████ ██ ██ ████',
|
|
105
|
+
'████ ██ ██ ██████ ██ ██ ██ ██ ████ ██ ██ ████',
|
|
106
|
+
'████ ██████████ ██████ ████ ████ ██ ██████████ ████',
|
|
107
|
+
'████ ██ ██ ██ ██ ██ ██ ██ ██ ████',
|
|
108
|
+
'████████████████████ ██████ ██ ████ ██████████████████████',
|
|
109
|
+
'████ ██ ██ ██ ██████████ ██████████ ████ ██ ████',
|
|
110
|
+
'████████ ██████████████ ██ ████ ██ ██████ ████',
|
|
111
|
+
'████████ ██ ██ ██ ██ ██ ██████ ██████ ██████',
|
|
112
|
+
'████ ██ ████████ ████████ ████ ██████ ██ ████ ████',
|
|
113
|
+
'████ ████ ██ ██ ██ ██████████████████ ████████',
|
|
114
|
+
'████ ██ ████ ██ ██ ██ ██ ██ ██ ████ ████████ ████',
|
|
115
|
+
'████ ████ ████ ████ ████ ████ ██ ████',
|
|
116
|
+
'████ ██ ████ ██ ██ ██ ████ ██████ ██████',
|
|
117
|
+
'████ ████ ██ ██ ████ ██ ████ ██████',
|
|
118
|
+
'██████████ ████████████ ████ ██████████████ ██████',
|
|
119
|
+
'████ ██ ████ ██ ██ ████████████ ██ ██ ████████',
|
|
120
|
+
'████████████████████ ██ ██████ ██ ████████ ████████ ████████',
|
|
121
|
+
'██████ ████ ████ ██ ████ ██ ████████',
|
|
122
|
+
'████████████████████ ████ ██ ██ ██ ██████ ████',
|
|
123
|
+
'████ ██ ██ ████ ██ ██ ██ ██ ██ ██████',
|
|
124
|
+
'████ ██████████ ██ ██ ██████ ██ ██████ ████ ████',
|
|
125
|
+
'████ ██ ██ ████ ██ ██ ██ ██ ████',
|
|
126
|
+
'████ ██ ██ ██ ████ ██ ████ ██ ████ ██ ████',
|
|
127
|
+
'████ ██ ██ ██ ██ ████ ██ ██ ████ ██ ████ ██ ████',
|
|
128
|
+
'████ ██████████ ████████ ██ ████ ██ ██ ██ ██████',
|
|
129
|
+
'████ ██ ██ ██ ██████ ████████ ██ ██████',
|
|
130
|
+
'██████████████████████████████████████████████████████████████████',
|
|
131
|
+
'██████████████████████████████████████████████████████████████████',].join('\n');
|
|
132
|
+
|
|
133
|
+
var qr = qrcode(-1, 'M');
|
|
134
|
+
qr.addData(unescape(encodeURI(sourceText)));
|
|
135
|
+
qr.make();
|
|
136
|
+
|
|
137
|
+
expect(qr.createASCII() ).to.equal(correctTextData1, 'ASCII QRCode of size 1 is incorrect');
|
|
138
|
+
expect(qr.createASCII(1, 0) ).to.equal(correctTextData2, 'ASCII QRCode of size 1 without margin is incorrect');
|
|
139
|
+
expect(qr.createASCII(2) ).to.equal(correctTextData3, 'ASCII QRCode of size 2 is incorrect');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const sjis = function(qrcode) {
|
|
146
|
+
describe('QRCode', function(){
|
|
147
|
+
it('correct qr', function(){
|
|
148
|
+
|
|
149
|
+
let s = '';
|
|
150
|
+
s += 'data:image/gif;base64,R0lGODdhUgBSAIAAAAAAAP///ywAAAAAUgBSAAAC/4yPqcvtD6OctNqLs9';
|
|
151
|
+
s += '68+w+G4kiW5mkC6sqyhsq4ATyvUIvbU56/QKyjyRw8HIUG9CGKv4Ow6XsSoRHkQuosLptWmVXxfTy9XJ';
|
|
152
|
+
s += '2ytuVtz0b0rkyOUrHyNhsepN7w2Hb47ldWJ/g2CJiXVBN4SFfFRyh3BvbY9yjpaOgWqZkw1nKX+dcgyq';
|
|
153
|
+
s += 'jXiahoSsq5N5UJVBm2ujrJVAnqdptrS3vKi6sbTNlzEpc61YtSSzh0ZTbSbJe1Ccs8N3z0LH2IbL2W2m';
|
|
154
|
+
s += 'wh+5xmPYtKfTEuahzuC3lcwZ53Hmt6iV/o7NnN7TyJwZMuXIOiWTol7mCjhVqmgVN1D9PDSwLRIeREJt';
|
|
155
|
+
s += 'm/if8YsbFy2IVexGr8Hjb6piZeQXJiPsVLOW9lOibZqm2iCfKaMYD6lt1sSJBjTH0nN5a0+Y7DwFHmRq';
|
|
156
|
+
s += 'rMorHVu5DpfO5yl0/COm14+l1lmbUl1ZxWjzpKqZUrSoj2sqE9yxInUrM4o0KNC3Rf03KL1DVsB0+uSZ';
|
|
157
|
+
s += 'ca6qJi+PZXBsBDYUYsWdHtXqPEGh8mDBdy4Mce+1YVKzKo5UA7nyYkzesaxb9g/aJWLJq13UQZK3dlGt';
|
|
158
|
+
s += 'Jg4duGP5fjq1qe2qdmyw4bK3ntWKx3S+kuMa/tRuWtlXKWzpO63dQ6nTJ2WfS0rd+4mwK27or45sQQ0T';
|
|
159
|
+
s += 'OduZ5YvtmUz7+0TVK+w7ShJjtXzr/NR+l5RlZ9mHWznULtCfgVc8sk2B9w7M0XnIMtRXiXYEUtV92F73';
|
|
160
|
+
s += 'XkTyIpeLdZiNNBl1p/9XjDIH3cqUiiMCIqQ2ONNt6IY4467shjjz7+CGSQBxQAADs=';
|
|
161
|
+
|
|
162
|
+
const qr = qrcode(4, 'L');
|
|
163
|
+
qr.addData('あいう澤', 'Kanji');
|
|
164
|
+
qr.addData('abcあいう①', 'Byte');
|
|
165
|
+
qr.make();
|
|
166
|
+
expect(capture('s', qr.createDataURL() ) ).to.equal(s);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export const utf8 = function(qrcode) {
|
|
172
|
+
describe('QRCode', function(){
|
|
173
|
+
it('correct qr', function(){
|
|
174
|
+
|
|
175
|
+
let s = '';
|
|
176
|
+
s += 'data:image/gif;base64,R0lGODdhcgByAIAAAAAAAP///ywAAAAAcgByAAAC/4yPqcvtD6OctNqLs9';
|
|
177
|
+
s += '68+w+G4kiW5omm6sq2bgXE8jwrsVEHty7bAEKjAX+8oZEXDFKSSR+uV0QSj0/mcfe8MoUT7GK35Waj4G';
|
|
178
|
+
s += 'mirIxWoV5n1+wO58blcbypltYb7Qeabfa35uCVRheIl/O3J7FIVPgI2Eelh2hXKUjGNckXqRh5OKfpNt';
|
|
179
|
+
s += 'iZCbnGGOF4GArVeobIWfqpVfuWCnpwewkZpjUkese76gkYrNsruwW8K/ZlrAoxq7knav3qjOrcTElaTG';
|
|
180
|
+
s += 'js2iwsRbndR03tI6eLDfs+Kh/vaPXWDu+un88/r49f4lQ2dnDy0BIX6wW0g+oGGjRXreC6DL8qKSOGzF';
|
|
181
|
+
s += '45ZP/9pBXTuGmZx1xpNmrb5w9DJpLPXJV7eQwix5OlliBkCZMlwZ0ReTIsOM2SzIQ05V0aZwphyWS4uA';
|
|
182
|
+
s += '09F3ObLaBFP92amNHhyjwArwlVRtBXSz94pkKt6BWqN4snTTJIN1aVVGhiDRmNZRer06x31CbNmvahzr';
|
|
183
|
+
s += '3gFnIti0lStqsO18KywEkuYrTPGDd8y9TmxX+Lo4asWzlz1bFBN7tcdrpmYnRUrTYmyxMmaNesMQ9W7b';
|
|
184
|
+
s += 'ZTbK2dQQaOHK036gsCNRALjPPr0LmNlFJtLnluRdOE9foNig2u198ihzMvfPRvT7zCa7f1rhx7+dahkX';
|
|
185
|
+
s += 'JfGg445NAm83LGHXxk0W/Qbxr/3mobW4+t1tlM8wFIFILDFHjYdA0+9xEzENnT0XCYZScURvdISBuD8a';
|
|
186
|
+
s += 'i2G34HmZCbdBJ52J1rA5L4GliEifjgUh9+4OBWGNao3Gz0QdiffTDWM1mOKe5o03f1tfjiQ5ad6BNxDB';
|
|
187
|
+
s += 'pIXmlEzYSgdjxG2A9goi0JYpROeWTdaCsmFh6XT3mZZZLzhbVlfryFeKaVXa5JHphuwgVnTl7mxmZydo';
|
|
188
|
+
s += '1IoIwQdkhZkYoBROWdiSBJKIdXJqrXdu0wWZ2QR/K5J5JQTvpmpWe99ueGgoZzHVs4lnmifuqNqpun5y';
|
|
189
|
+
s += 'XXTZIaxofYpkNSaKp/AQJ6YK37xSgHX+ORKuYGoPE3oa7J/+Jqp5Zhfopnpl02ah60pMF2l1nnqZgge7';
|
|
190
|
+
s += 'flimlfgg1L4LSinXasgOCRG2qToeqYromafbmeesJaK6lkjpHVbrdIXRhcrIzBaCim9DB6aIbo/Tvurv';
|
|
191
|
+
s += 'SG96ObC8764JzYksOeebiie27FZ64KKoph6gmvYlAWHDJrI3daso2atgpkowK3Jx4ryUKMbcwJV6tuQz';
|
|
192
|
+
s += 'c6h7O9DxvmIsDi+unfs3Qp7PB3J9/V1ZMUpXorit/K66q5Ssu5Lc1Aloq11o/WmbHCl/2aaMROw3Dte4';
|
|
193
|
+
s += 'NaKO1ySY8NMNcyKzmpxfht3PDSdu/cZtQ+V42sBxTrjKyZa3ErwuGKJu5ZtJDSHajJNaijJNDggEoeIW';
|
|
194
|
+
s += 'WapzReiZY325TDMyP6a9hxStgcsUdXznXRHjtLuc22C0k74kNzum+A8OUKdrDl7p63mjCHNFjJbCr+n9';
|
|
195
|
+
s += 'kvT/VzdL4W+vHQqTX1e79mqhwkdSDNm33bkTOl+4B3r0zswF0D5zisx8/ru2e0191x+c2j7JuyaY+rPL';
|
|
196
|
+
s += '3hryw4/RVLPutzHvMUgsAEKnCBDGygAx8IwQhKcIIUrKAFL0iCAgAAOw==';
|
|
197
|
+
|
|
198
|
+
const qr = qrcode(8, 'L');
|
|
199
|
+
qr.addData('abcあいうĀ👏', 'Byte');
|
|
200
|
+
qr.make();
|
|
201
|
+
expect(capture('s', qr.createDataURL() ) ).to.equal(s);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const misc = function(qrcode) {
|
|
207
|
+
describe('QRCode', function(){
|
|
208
|
+
it('mixed qr', function(){
|
|
209
|
+
|
|
210
|
+
let s = '';
|
|
211
|
+
s += 'data:image/gif;base64,R0lGODdhWgBaAIAAAAAAAP///ywAAAAAWgBaAAAC/4yPqcvtD6OctNqLs9';
|
|
212
|
+
s += '68+w+G4kiW5ommHcC2rmu8QDwvLC3TjszXUp8LBG+2Wk/XAL4oRAYx6GwhYUmjr8i8Kp7LKhenTXyrWf';
|
|
213
|
+
s += 'CYe5Z6reBptxlBq9P0MIIqd+PtZOHbOmbW5Xb3J4j0AziniOh3dBDouHjoVyYZGVW3M1l5yTYhh1mkuU';
|
|
214
|
+
s += 'bo2QgBt/UpSGXaqoYqxhe12ahUeAuU25eolGYK3Cn8GxtX/EmcvByMbAIXiQvJqnLMC707LSvieorlKa';
|
|
215
|
+
s += 'o3OMyThd19Xd65CpsOBaqoqr0+206/OkT7EMoXTp6/CeCFYm3AGYuWbU9BCwQlwcKm65FChxXk7ZHIqN';
|
|
216
|
+
s += 'Q/Z//39oW5qC6PRn7S5KWKd/AKulmkMqk0lsheRH0TVxY6p8+STYoiXYoraHJgRnzLggLNONEXNWk+Nw';
|
|
217
|
+
s += 'ZkNk/pzHdEf45cmvPbyXQ31b3iyYlhVl1TxyEUabSPwJoh+6Hkxw4eJbRvqbn7szJtXErNahncNg2hJb';
|
|
218
|
+
s += '7kAJO0yxIrB4EPX5YFiVPvsaQGIdIraXacTsfeeo4q6jWqULKdh34WR7VjzL/1KDb1TBS2NdZ3n1p1Kf';
|
|
219
|
+
s += 'sk3aBs0/bmjAHkwsS3TzsVrQGj1OO4F0lWStk288/CM3hm+zhl2eFih2O/nO1rvufUw7dW/g2jRZgeG8';
|
|
220
|
+
s += 'ZF/77tevKoP9r3C7/83tmp1+Pbb/uUfx90415hgckHnGrWpcSUgY15l2ByKDXjGyePELbYhAbudJRM3p';
|
|
221
|
+
s += 'jzUoMcggVhQ/S5VhmDNFmoImYk5MVihaIIww17v0knoD/NXahgV8X5uKFm7f3CC46mAVnHiRXKclZoNC';
|
|
222
|
+
s += 'I3mlr3gcfjk4Bt9htkYZ2HDGP8GcJafnd1qWN6YPoVn5dMQrWamq2leSaUVno0l30iYpUakmNxGV2Klk';
|
|
223
|
+
s += 'XGnp7dSamMjKDhJKEtJE5X1UaILmgiaEZyN4+A0CUk6VWUfnVlNZ5+Cmqooo5KaqmmnopqqqquGkIBAD';
|
|
224
|
+
s += 's=';
|
|
225
|
+
|
|
226
|
+
const qr = qrcode(5, 'L');
|
|
227
|
+
qr.addData('012345', 'Numeric');
|
|
228
|
+
qr.addData('ABC123', 'Alphanumeric');
|
|
229
|
+
qr.addData('漢字', 'Kanji');
|
|
230
|
+
qr.addData('abcあいう', 'Byte');
|
|
231
|
+
qr.make();
|
|
232
|
+
expect(capture('s', qr.createDataURL() ) ).to.equal(s);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('img tag (for coverage)', function(){
|
|
236
|
+
|
|
237
|
+
let s = '';
|
|
238
|
+
s += '<img src="data:image/gif;base64,R0lGODdhQQBBAIAAAAAAAP///ywAAAAAQQBBAAAC/4yPqcvt';
|
|
239
|
+
s += 'D6KctLYqD9428B9dmwZyRmkyqYdiZ/iQgNyx83vHNq7zeJ3x6YLBIcwGPBZjROVIqFgVpbDpc6e6Wl2+';
|
|
240
|
+
s += 'bTIX1Tq5WC9FRjuihdSbebJGqtnjL538Dufe27s9sXSXBtdVdwaFiKXY5neoGBfHN5Yosjf3SJnldlkJ';
|
|
241
|
+
s += 'mRjo0AQGMQl4Cdop11K6aLi6+don+BNL+xrJGkvYYzTK+wucGjxM7FlcWTIIKttqObqqfJo7/dwS7cuc';
|
|
242
|
+
s += 'zYnwt6ArjKpqfL2iNy6eqZqsuVZzjes8KGyr1629a87t+D7bHI65zp+0D/X2qXOUxxRBhe4O7kqob2HE';
|
|
243
|
+
s += 'hvbEPBwIrCIehJkYf2n8wuzcMVIbsXXEVIyRwnwoiamMyFLUN1vd5CHSJemiSZ0Ma9HkuDNkS3Yre4A8';
|
|
244
|
+
s += '9I+lyILOOiQtCtMoUKeu7t2LuS0nvKtQw2ltFO8Tq64WbTpctm0rULMBlwrkSe8nvnRgra6Ny+vrW7u+';
|
|
245
|
+
s += 'SPLbS+2pUr91r7gVDI+cwaFuowImcxhn05PGKEo2W3lgIMmTdw5GNzI0sQIAOw==" width="65" hei';
|
|
246
|
+
s += 'ght="65" alt="a<>"&\'\\z"/>';
|
|
247
|
+
|
|
248
|
+
const qr = qrcode(1, 'L');
|
|
249
|
+
qr.addData('abc');
|
|
250
|
+
qr.make();
|
|
251
|
+
expect(capture('s', qr.createImgTag(3, 1, 'a<>"&\'\\z') ) ).to.equal(s);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('table tag (for coverage)', function(){
|
|
255
|
+
const qr = qrcode(1, 'L');
|
|
256
|
+
qr.addData('{TABLE}');
|
|
257
|
+
qr.make();
|
|
258
|
+
expect(!!qr.createTableTag() ).to.be.true;
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('svg tag (for coverage)', function(){
|
|
262
|
+
const qr = qrcode(1, 'Q');
|
|
263
|
+
qr.addData('{SVG}');
|
|
264
|
+
qr.make();
|
|
265
|
+
expect(!!qr.createSvgTag() ).to.be.true;
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('svg tag by object (for coverage)', function(){
|
|
269
|
+
const qr = qrcode(1, 'H');
|
|
270
|
+
qr.addData('{SVG}');
|
|
271
|
+
qr.make();
|
|
272
|
+
expect(!!qr.createSvgTag({}) ).to.be.true;
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('svg tag by object (for coverage)', function(){
|
|
276
|
+
|
|
277
|
+
let count = 0;
|
|
278
|
+
let check = 0;
|
|
279
|
+
const context = {
|
|
280
|
+
fillStyle : '',
|
|
281
|
+
fillRect : function(x, y, _width, _height) {
|
|
282
|
+
count += 1;
|
|
283
|
+
if (this.fillStyle == 'black') {
|
|
284
|
+
check += x + y * 21;
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const qr = qrcode(1, 'H');
|
|
290
|
+
qr.addData('{2d}');
|
|
291
|
+
qr.make();
|
|
292
|
+
qr.renderTo2dContext(context);
|
|
293
|
+
expect(count).to.equal(21 * 21);
|
|
294
|
+
expect(check).to.equal(93106);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('- (for coverage)', function(){
|
|
298
|
+
|
|
299
|
+
let s = '';
|
|
300
|
+
s += 'data:image/gif;base64,R0lGODdhSgBKAIAAAAAAAP///ywAAAAASgBKAAAC/4yPqcvtD6OctNqLs9';
|
|
301
|
+
s += '68+w+G4kiWZgKk6roiLGC8aay68kvd+LHf9MzTtSZABnB4rAWSxSWs0YREUU9kVcl80hxT7tW6pdrCim';
|
|
302
|
+
s += 'wy98Vey1onWewEE9PnuO7XbprXc3xdmDUW5McnsRfWFRQI19MmRceXiDfJyPL26EWIVmfk+CDpZgfKxr';
|
|
303
|
+
s += 'kwSgUYqYqomroJyBob+pfqCeIzW3jyKle6qyfTCdx7lzFsaaqkmYuLAUxpqGy3fNopOBR9TG0L5blo4z';
|
|
304
|
+
s += 'uY/NxXOSXHJpzH/XrNTU7YyIGday0ej1ytKC1fH4pvz8KObbKO0RPkDBK4dW+s1GL3SeE+dwvxNSvHqh';
|
|
305
|
+
s += 'SuPegakUVz17HfxnUHIxz6h5LeOZK60BC8Nw1mQzUCW4pKA+3mwJj6ZC1cpBLWRJS8IHakmOxShZ3pUj';
|
|
306
|
+
s += 'IkKq7nUGI+o+K8qfQR0FVQaZ2Uas8ry5lCciYsyI/mvpFgY/40Ki2jUKklmaLyBmkkibL+EK6F6IFvuJ';
|
|
307
|
+
s += 'Uls83lSoxWxTmu/G2lFBIwnLDv0prFegFUuJzf/p7FTC4ox8MuQT8VnZd0uX5ym6rbbFJi6LhQ32aN/X';
|
|
308
|
+
s += 'JnUFIsC3fL7dFt17R2M/0+frn0R+RJh342zJcsXotCoReT3vRh8V3cu3v/Dj68+PHky5s/b74AADs=';
|
|
309
|
+
|
|
310
|
+
const qr = qrcode(3, 'H');
|
|
311
|
+
qr.addData('A\u0020$%*+-./:Z', 'Alphanumeric');
|
|
312
|
+
qr.addData('1234', 'Numeric');
|
|
313
|
+
qr.addData('12345', 'Numeric');
|
|
314
|
+
qr.addData('123456', 'Numeric');
|
|
315
|
+
qr.make();
|
|
316
|
+
expect(capture('s', qr.createDataURL() ) ).to.equal(s);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
const dataURLHandler = function(dataURL) {
|
|
320
|
+
expect(!!dataURL).to.be.true;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
[1, 20, 27].forEach( (t) => {
|
|
324
|
+
['L', 'M', 'Q', 'H'].forEach( (e) => {
|
|
325
|
+
it('addData - Numeric (for coverage)', function(){
|
|
326
|
+
const qr = qrcode(t, e);
|
|
327
|
+
qr.addData('1', 'Numeric');
|
|
328
|
+
qr.make();
|
|
329
|
+
dataURLHandler(qr.createDataURL() );
|
|
330
|
+
});
|
|
331
|
+
it('addData - Alphanumeric (for coverage)', function(){
|
|
332
|
+
const qr = qrcode(t, e);
|
|
333
|
+
qr.addData('A1', 'Alphanumeric');
|
|
334
|
+
qr.make();
|
|
335
|
+
dataURLHandler(qr.createDataURL() );
|
|
336
|
+
});
|
|
337
|
+
it('addData - Kanji (for coverage)', function(){
|
|
338
|
+
const qr = qrcode(t, e);
|
|
339
|
+
qr.addData('漢', 'Kanji');
|
|
340
|
+
qr.make();
|
|
341
|
+
dataURLHandler(qr.createDataURL() );
|
|
342
|
+
});
|
|
343
|
+
it('addData - Byte (for coverage)', function(){
|
|
344
|
+
const qr = qrcode(t, e);
|
|
345
|
+
qr.addData('A1漢', 'Byte');
|
|
346
|
+
qr.make();
|
|
347
|
+
dataURLHandler(qr.createDataURL() );
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
});
|
|
353
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" >
|
|
5
|
+
<title>qrcode | default</title>
|
|
6
|
+
<script src="../dist/qrcode.js"></script>
|
|
7
|
+
<script type="module">
|
|
8
|
+
|
|
9
|
+
import { runTests } from '@web/test-runner-mocha';
|
|
10
|
+
import { overview as test } from './qrcode-test-impl.js';
|
|
11
|
+
|
|
12
|
+
runTests(async () => {
|
|
13
|
+
test(qrcode);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
</script>
|
|
17
|
+
</head>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" >
|
|
5
|
+
<title>qrcode | SJIS</title>
|
|
6
|
+
<script src="../dist/qrcode.js"></script>
|
|
7
|
+
<script src="../dist/qrcode_SJIS.js"></script>
|
|
8
|
+
<script type="module">
|
|
9
|
+
|
|
10
|
+
import { runTests } from '@web/test-runner-mocha';
|
|
11
|
+
import { sjis as test } from './qrcode-test-impl.js';
|
|
12
|
+
import { misc } from './qrcode-test-impl.js';
|
|
13
|
+
|
|
14
|
+
runTests(async () => {
|
|
15
|
+
test(qrcode);
|
|
16
|
+
misc(qrcode);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
</script>
|
|
20
|
+
</head>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { qrcode } from '../dist/qrcode.mjs';
|
|
3
|
+
import { stringToBytes } from '../dist/qrcode_SJIS.mjs';
|
|
4
|
+
import { sjis as test } from './qrcode-test-impl.js';
|
|
5
|
+
import { misc } from './qrcode-test-impl.js';
|
|
6
|
+
|
|
7
|
+
qrcode.stringToBytes = stringToBytes;
|
|
8
|
+
|
|
9
|
+
test(qrcode);
|
|
10
|
+
misc(qrcode);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" >
|
|
5
|
+
<title>qrcode | UTF8</title>
|
|
6
|
+
<script src="../dist/qrcode.js"></script>
|
|
7
|
+
<script src="../dist/qrcode_UTF8.js"></script>
|
|
8
|
+
<script type="module">
|
|
9
|
+
|
|
10
|
+
import { runTests } from '@web/test-runner-mocha';
|
|
11
|
+
import { utf8 as test } from './qrcode-test-impl.js';
|
|
12
|
+
|
|
13
|
+
runTests(async () => {
|
|
14
|
+
test(qrcode);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
</script>
|
|
18
|
+
</head>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
//import { qrcode } from '../dist/qrcode.mjs';
|
|
3
|
+
import qrcode from '../dist/qrcode.mjs'; // test import default
|
|
4
|
+
import { stringToBytes } from '../dist/qrcode_UTF8.mjs';
|
|
5
|
+
import { utf8 as test } from './qrcode-test-impl.js';
|
|
6
|
+
|
|
7
|
+
qrcode.stringToBytes = stringToBytes;
|
|
8
|
+
|
|
9
|
+
test(qrcode);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddessentials/agent-guild",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Launch and watch AI coding-assistant terminal sessions from one local web page. A bundled session manager owns the terminals so the page can close and reconnect.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@xterm/headless": "^6.0.0",
|
|
43
43
|
"@xterm/xterm": "^6.0.0",
|
|
44
44
|
"node-pty": "^1.2.0-beta.15",
|
|
45
|
+
"qrcode-generator": "2.0.4",
|
|
45
46
|
"ws": "^8.22.0"
|
|
46
47
|
},
|
|
47
48
|
"bundleDependencies": true,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isIP } from 'node:net';
|
|
2
|
+
|
|
3
|
+
export function parseAllowedHosts(value = '') {
|
|
4
|
+
if (typeof value !== 'string' || value.length > 16384) throw new Error('Allowed hosts must be a comma-separated list of hostnames.');
|
|
5
|
+
const entries = value.split(',').map((entry) => entry.trim().toLowerCase()).filter(Boolean);
|
|
6
|
+
if (entries.length > 64) throw new Error('At most 64 allowed hosts may be configured.');
|
|
7
|
+
for (const entry of entries) {
|
|
8
|
+
const match = /^(\[[0-9a-f:.]+\]|[a-z0-9.-]+)(?::([1-9]\d{0,4}))?$/.exec(entry);
|
|
9
|
+
const name = match?.[1];
|
|
10
|
+
const validName = name?.startsWith('[') ? isIP(name.slice(1, -1)) === 6
|
|
11
|
+
: name && name.length <= 253 && name.split('.').every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label));
|
|
12
|
+
if (!validName || (match[2] && Number(match[2]) > 65535)) {
|
|
13
|
+
throw new Error(`Invalid allowed host ${JSON.stringify(entry)}. Use a hostname with an optional port, such as guild.example.ts.net or guild.example.ts.net:8443; URLs and wildcards are not allowed.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return [...new Set(entries)];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function parseAllowedOrigins(value = '') {
|
|
20
|
+
if (typeof value !== 'string' || value.length > 16384) throw new Error('Allowed origins must be a comma-separated list of HTTP or HTTPS origins.');
|
|
21
|
+
const entries = value.split(',').map((entry) => entry.trim()).filter(Boolean);
|
|
22
|
+
if (entries.length > 64) throw new Error('At most 64 allowed origins may be configured.');
|
|
23
|
+
return [...new Set(entries.map((entry) => {
|
|
24
|
+
let url;
|
|
25
|
+
try { url = new URL(entry); } catch {}
|
|
26
|
+
if (!url || !['http:', 'https:'].includes(url.protocol) || url.origin !== entry || url.username || url.password) {
|
|
27
|
+
throw new Error(`Invalid allowed origin ${JSON.stringify(entry)}. Use an HTTP or HTTPS origin without a path or trailing slash.`);
|
|
28
|
+
}
|
|
29
|
+
parseAllowedHosts(url.host);
|
|
30
|
+
return url.origin;
|
|
31
|
+
}))];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function normalizeAccess({ hosts = [], origins = [] } = {}) {
|
|
35
|
+
if (!Array.isArray(hosts) || !Array.isArray(origins) || [...hosts, ...origins].some((value) => typeof value !== 'string')) {
|
|
36
|
+
throw new Error('Allowed hosts and origins must be lists of strings.');
|
|
37
|
+
}
|
|
38
|
+
return { hosts: parseAllowedHosts(hosts.join(',')), origins: parseAllowedOrigins(origins.join(',')) };
|
|
39
|
+
}
|
package/src/manager/config.mjs
CHANGED
|
@@ -44,6 +44,7 @@ export const paths = {
|
|
|
44
44
|
get providers() { return path.join(dataDir(), 'providers.json'); },
|
|
45
45
|
get accounts() { return path.join(dataDir(), 'accounts'); },
|
|
46
46
|
get github() { return path.join(dataDir(), 'github'); },
|
|
47
|
+
get remoteAccess() { return path.join(dataDir(), 'remote-access.json'); },
|
|
47
48
|
get log() { return path.join(dataDir(), 'manager.log'); },
|
|
48
49
|
/** Launchers for agent-guild-report, put first on every session's PATH. */
|
|
49
50
|
get shims() { return path.join(dataDir(), 'bin'); },
|