@lzpenguin/server 1.1.5 → 1.1.6
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/index.js +5 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -85,18 +85,14 @@ export class RiffleServer {
|
|
|
85
85
|
throw new Error('timestamp is required');
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
//
|
|
88
|
+
// 从全局变量或浏览器 URL 参数中读取 post_id 和 token
|
|
89
89
|
let postId;
|
|
90
90
|
let token;
|
|
91
91
|
|
|
92
|
-
if (isBrowser && typeof window !== 'undefined'
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
if (urlParams.has('token')) {
|
|
98
|
-
token = urlParams.get('token');
|
|
99
|
-
}
|
|
92
|
+
if (isBrowser && typeof window !== 'undefined') {
|
|
93
|
+
const postIdRaw = window.__RIFFLE_POST_ID__ || new URLSearchParams(location.search).get('post_id');
|
|
94
|
+
postId = postIdRaw ? parseInt(postIdRaw, 10) : undefined;
|
|
95
|
+
token = window.__RIFFLE_TOKEN__ || new URLSearchParams(location.search).get('token');
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
if (!postId) {
|