@alemonjs/qq-bot 2.1.11 → 2.1.13
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/dist/assets/index.css +1 -1
- package/dist/assets/index.js +5 -5
- package/lib/config.d.ts +1 -1
- package/lib/config.js +7 -2
- package/lib/desktop.js +4 -4
- package/lib/hook.js +1 -1
- package/lib/register.js +230 -446
- package/package.json +2 -2
package/lib/config.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export type Options = {
|
|
|
7
7
|
hideUnsupported?: boolean | number;
|
|
8
8
|
} & sdkOptions;
|
|
9
9
|
export declare const getQQBotConfig: () => Options;
|
|
10
|
-
export declare const getMaster: (UserId: string) => boolean;
|
|
10
|
+
export declare const getMaster: (UserId: string) => readonly [boolean, string];
|
package/lib/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getConfigValue, isMaster } from 'alemonjs';
|
|
1
|
+
import { getConfigValue, isMaster, createUserHashKey } from 'alemonjs';
|
|
2
2
|
|
|
3
3
|
const platform = 'qq-bot';
|
|
4
4
|
const getQQBotConfig = () => {
|
|
@@ -6,7 +6,12 @@ const getQQBotConfig = () => {
|
|
|
6
6
|
return value[platform] || {};
|
|
7
7
|
};
|
|
8
8
|
const getMaster = (UserId) => {
|
|
9
|
-
|
|
9
|
+
const isMasterUser = isMaster(UserId, platform);
|
|
10
|
+
const UserKey = createUserHashKey({
|
|
11
|
+
Platform: platform,
|
|
12
|
+
UserId
|
|
13
|
+
});
|
|
14
|
+
return [isMasterUser, UserKey];
|
|
10
15
|
};
|
|
11
16
|
|
|
12
17
|
export { getMaster, getQQBotConfig, platform };
|
package/lib/desktop.js
CHANGED
|
@@ -3,16 +3,16 @@ import { dirname, join } from 'path';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { getConfig, getConfigValue } from 'alemonjs';
|
|
5
5
|
|
|
6
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const activate = context => {
|
|
8
8
|
const webView = context.createSidebarWebView(context);
|
|
9
9
|
context.onCommand('open.qq-bot', () => {
|
|
10
|
-
const dir = join(__dirname, '../', 'dist', 'index.html');
|
|
10
|
+
const dir = join(__dirname$1, '../', 'dist', 'index.html');
|
|
11
11
|
const scriptReg = /<script.*?src="(.+?)".*?>/;
|
|
12
12
|
const styleReg = /<link.*?rel="stylesheet".*?href="(.+?)".*?>/;
|
|
13
13
|
const iconReg = /<link.*?rel="icon".*?href="(.+?)".*?>/g;
|
|
14
|
-
const styleUri = context.createExtensionDir(join(__dirname, '../', 'dist', 'assets', 'index.css'));
|
|
15
|
-
const scriptUri = context.createExtensionDir(join(__dirname, '../', 'dist', 'assets', 'index.js'));
|
|
14
|
+
const styleUri = context.createExtensionDir(join(__dirname$1, '../', 'dist', 'assets', 'index.css'));
|
|
15
|
+
const scriptUri = context.createExtensionDir(join(__dirname$1, '../', 'dist', 'assets', 'index.js'));
|
|
16
16
|
const html = readFileSync(dir, 'utf-8')
|
|
17
17
|
.replace(iconReg, '')
|
|
18
18
|
.replace(scriptReg, `<script type="module" crossorigin src="${scriptUri}"></script>`)
|
package/lib/hook.js
CHANGED