@blocklet/sdk 1.16.44-beta-20250529-004636-15e80e20 → 1.16.44-beta-20250601-083116-288e5ea5
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.
|
@@ -67,49 +67,6 @@ const tryWithTimeout = (asyncFn, timeout) => {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
|
-
const buildThemeStyles = (theme) => {
|
|
71
|
-
const { light, dark } = theme;
|
|
72
|
-
return `
|
|
73
|
-
<style id="blocklet-theme-style">
|
|
74
|
-
:root {
|
|
75
|
-
--blocklet-background-default-color: ${light.palette?.background?.default ?? '#fff'};
|
|
76
|
-
--blocklet-text-primary-color: ${light.palette?.text?.primary ?? '#000'};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
[data-theme='dark'] {
|
|
80
|
-
--blocklet-background-default-color: ${dark.palette?.background?.default ?? '#000'};
|
|
81
|
-
--blocklet-text-primary-color: ${dark.palette?.text?.primary ?? '#fff'};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
html, body {
|
|
85
|
-
background-color: var(--blocklet-background-default-color);
|
|
86
|
-
color: var(--blocklet-text-primary-color);
|
|
87
|
-
}
|
|
88
|
-
</style>
|
|
89
|
-
`;
|
|
90
|
-
};
|
|
91
|
-
const buildThemeScript = (theme) => {
|
|
92
|
-
return `
|
|
93
|
-
<script id="blocklet-theme-script">
|
|
94
|
-
(function() {
|
|
95
|
-
try {
|
|
96
|
-
const BLOCKLET_THEME_PREFER_KEY = '${theme_1.BLOCKLET_THEME_PREFER_KEY}';
|
|
97
|
-
${theme_1.isValidThemeMode.toString()}
|
|
98
|
-
${theme_1.getDefaultThemePrefer.toString()}
|
|
99
|
-
|
|
100
|
-
const prefer = getDefaultThemePrefer(${JSON.stringify({ theme: { prefer: theme.prefer } })});
|
|
101
|
-
if(prefer === 'dark') {
|
|
102
|
-
document.documentElement.setAttribute('data-theme', 'dark');
|
|
103
|
-
} else {
|
|
104
|
-
document.documentElement.removeAttribute('data-theme');
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {
|
|
107
|
-
console.error('Theme init error:', e);
|
|
108
|
-
}
|
|
109
|
-
})();
|
|
110
|
-
</script>
|
|
111
|
-
`;
|
|
112
|
-
};
|
|
113
70
|
const fallback = (file, options = {}) => {
|
|
114
71
|
const filePath = options.root ? (0, path_1.join)(options.root, file) : file;
|
|
115
72
|
// Check file existence during initialization
|
|
@@ -176,8 +133,8 @@ const fallback = (file, options = {}) => {
|
|
|
176
133
|
.replace('<script src="__meta__.js"></script>', `<script>${blockletJs}</script>`);
|
|
177
134
|
}
|
|
178
135
|
// Inject theme styles and script
|
|
179
|
-
const themeStyles = buildThemeStyles(theme);
|
|
180
|
-
const themeScript = buildThemeScript(theme);
|
|
136
|
+
const themeStyles = (0, theme_1.buildThemeStyles)(theme);
|
|
137
|
+
const themeScript = (0, theme_1.buildThemeScript)(theme);
|
|
181
138
|
// 注入主题样式
|
|
182
139
|
if (!source.includes('<style id="blocklet-theme">')) {
|
|
183
140
|
source = source.replace(HEAD_END_TAG, `${themeStyles}${HEAD_END_TAG}`);
|
|
@@ -84,6 +84,7 @@ declare const _default: {
|
|
|
84
84
|
componentCall?: boolean;
|
|
85
85
|
signedToken?: boolean;
|
|
86
86
|
accessKey?: boolean;
|
|
87
|
+
signedTokenKey?: string;
|
|
87
88
|
}) => (req: import("express").Request & {
|
|
88
89
|
user?: import("../util/login").SessionUser;
|
|
89
90
|
}, res: import("express").Response, next: import("express").NextFunction) => Promise<void>;
|
|
@@ -3,7 +3,7 @@ const get_token_from_req_1 = require("@abtnode/util/lib/get-token-from-req");
|
|
|
3
3
|
const login_1 = require("../util/login");
|
|
4
4
|
const verify_session_1 = require("../util/verify-session");
|
|
5
5
|
const sessionMiddleware = (options = {}) => {
|
|
6
|
-
const { loginToken = true, componentCall = false, signedToken = '', strictMode = false, accessKey = false } = options;
|
|
6
|
+
const { loginToken = true, componentCall = false, signedToken = '', strictMode = false, accessKey = false, signedTokenKey = '__jwt', } = options;
|
|
7
7
|
return async (req, res, next) => {
|
|
8
8
|
let result = null;
|
|
9
9
|
try {
|
|
@@ -31,7 +31,7 @@ const sessionMiddleware = (options = {}) => {
|
|
|
31
31
|
}
|
|
32
32
|
// authenticate by signed tmp token: which expires in 5 minutes
|
|
33
33
|
if (!result && signedToken) {
|
|
34
|
-
const token = req.query
|
|
34
|
+
const token = req.query[signedTokenKey] || '';
|
|
35
35
|
result = await (0, verify_session_1.verifySignedToken)({ token, strictMode });
|
|
36
36
|
}
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.44-beta-
|
|
6
|
+
"version": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
7
7
|
"description": "graphql client to read/write data on abt node",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"typings": "lib/index.d.ts",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/client": "1.16.44-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.44-beta-
|
|
32
|
-
"@abtnode/util": "1.16.44-beta-
|
|
30
|
+
"@abtnode/client": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
31
|
+
"@abtnode/constant": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
32
|
+
"@abtnode/util": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
33
33
|
"@arcblock/did": "1.20.11",
|
|
34
34
|
"@arcblock/did-auth": "1.20.11",
|
|
35
35
|
"@arcblock/jwt": "1.20.11",
|
|
36
36
|
"@arcblock/ws": "1.20.11",
|
|
37
|
-
"@blocklet/constant": "1.16.44-beta-
|
|
38
|
-
"@blocklet/env": "1.16.44-beta-
|
|
39
|
-
"@blocklet/error": "^0.2.
|
|
40
|
-
"@blocklet/meta": "1.16.44-beta-
|
|
41
|
-
"@blocklet/theme": "^2.13.
|
|
37
|
+
"@blocklet/constant": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
38
|
+
"@blocklet/env": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
39
|
+
"@blocklet/error": "^0.2.5",
|
|
40
|
+
"@blocklet/meta": "1.16.44-beta-20250601-083116-288e5ea5",
|
|
41
|
+
"@blocklet/theme": "^2.13.57",
|
|
42
42
|
"@did-connect/authenticator": "^2.2.8",
|
|
43
43
|
"@did-connect/handler": "^2.2.8",
|
|
44
44
|
"@nedb/core": "^2.1.5",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"ts-node": "^10.9.1",
|
|
85
85
|
"typescript": "^5.6.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "5d978739f099374dcc9d4ce9572eb343fd0c39b4"
|
|
88
88
|
}
|