@alemonjs/bubble
Advanced tools
+21
| The MIT License (MIT) | ||
| Copyright (c) 2013-present, Yuxi (Evan) You | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIdED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
+1
-1
@@ -17,2 +17,2 @@ import { BUBBLEOptions } from './sdk/wss.types'; | ||
| }; | ||
| export declare const getMaster: (UserId: string) => readonly [boolean, string]; | ||
| export declare const getMaster: (UserId: string) => readonly [any, string]; |
+5
-2
@@ -1,2 +0,2 @@ | ||
| import { useUserHashKey, getConfigValue } from 'alemonjs'; | ||
| import { getConfigValue, useUserHashKey } from 'alemonjs'; | ||
| import { GATEWAY_URL, API_URL, CDN_URL } from './sdk/api.js'; | ||
@@ -23,2 +23,5 @@ | ||
| const getMaster = (UserId) => { | ||
| const values = getConfigValue() || {}; | ||
| const mainMasterKey = values.master_key || []; | ||
| const mainMasterId = values.master_id || []; | ||
| const config = getBubbleConfig(); | ||
@@ -31,3 +34,3 @@ const masterKey = config.master_key || []; | ||
| }); | ||
| const is = masterKey.includes(UserKey) || masterId.includes(UserId); | ||
| const is = mainMasterKey.includes(UserKey) || mainMasterId.includes(UserId) || masterKey.includes(UserKey) || masterId.includes(UserId); | ||
| return [is, UserKey]; | ||
@@ -34,0 +37,0 @@ }; |
+10
-5
| const markdownToBubbleText = (items, hideUnsupported) => { | ||
| if (Number(hideUnsupported) >= 4) | ||
| if (Number(hideUnsupported) >= 4) { | ||
| return ''; | ||
| } | ||
| return items | ||
@@ -22,4 +23,5 @@ .map(item => { | ||
| const v = item.value; | ||
| if (Number(hideUnsupported) >= 3) | ||
| if (Number(hideUnsupported) >= 3) { | ||
| return ''; | ||
| } | ||
| return Number(hideUnsupported) >= 2 ? v.url : `[${v.text}](${v.url})`; | ||
@@ -56,4 +58,5 @@ } | ||
| case 'MD.button': { | ||
| if (Number(hideUnsupported) >= 3) | ||
| if (Number(hideUnsupported) >= 3) { | ||
| return ''; | ||
| } | ||
| if (Number(hideUnsupported) >= 2) { | ||
@@ -76,4 +79,5 @@ const btnData = item.options?.data || (typeof item.value === 'object' ? item.value.title : item.value); | ||
| const markdownRawToBubbleText = (raw, hideUnsupported) => { | ||
| if (Number(hideUnsupported) >= 4) | ||
| if (Number(hideUnsupported) >= 4) { | ||
| return ''; | ||
| } | ||
| if (hideUnsupported) { | ||
@@ -85,4 +89,5 @@ return raw.replace(/!\[([^\]]*)\]\([^)]*\)/g, ''); | ||
| const dataEnumToBubbleText = (item, hideUnsupported) => { | ||
| if (Number(hideUnsupported) >= 4) | ||
| if (Number(hideUnsupported) >= 4) { | ||
| return ''; | ||
| } | ||
| switch (item.type) { | ||
@@ -89,0 +94,0 @@ case 'MarkdownOriginal': |
+34
-0
@@ -295,2 +295,36 @@ import { BubbleClient } from './sdk/wss.js'; | ||
| } | ||
| else if (data.action === 'media.upload') { | ||
| const params = data.payload.params; | ||
| const fileData = params?.url ?? params?.data; | ||
| if (!fileData) { | ||
| consume([createResult(ResultCode.FailParams, 'Missing url or data', null)]); | ||
| } | ||
| else { | ||
| const res = await client | ||
| .uploadFile(fileData, params?.name) | ||
| .then(r => createResult(ResultCode.Ok, data.action, r)) | ||
| .catch(err => createResult(ResultCode.Fail, data.action, err)); | ||
| consume([res]); | ||
| } | ||
| } | ||
| else if (data.action === 'history.list') { | ||
| const res = await client | ||
| .getChannelMessages(data.payload.ChannelId) | ||
| .then(r => createResult(ResultCode.Ok, data.action, r)) | ||
| .catch(err => createResult(ResultCode.Fail, data.action, err)); | ||
| consume([res]); | ||
| } | ||
| else if (data.action === 'member.search') { | ||
| const guildId = data.payload.GuildId; | ||
| const keyword = data.payload.params?.keyword ?? ''; | ||
| const res = await client | ||
| .listGuildMembers(guildId) | ||
| .then(r => { | ||
| const list = Array.isArray(r) ? r : []; | ||
| const filtered = list.filter((m) => (m.name ?? '').includes(keyword) || (m.username ?? '').includes(keyword)); | ||
| return createResult(ResultCode.Ok, data.action, filtered); | ||
| }) | ||
| .catch(err => createResult(ResultCode.Fail, data.action, err)); | ||
| consume([res]); | ||
| } | ||
| else { | ||
@@ -297,0 +331,0 @@ consume([createResult(ResultCode.Fail, '未知请求,请尝试升级版本', null)]); |
+4
-3
| { | ||
| "name": "@alemonjs/bubble", | ||
| "version": "2.1.5", | ||
| "version": "2.1.6", | ||
| "description": "bubble platform", | ||
@@ -64,3 +64,4 @@ "author": "lemonade", | ||
| "url": "https://github.com/lemonade-lab/alemonjs.git" | ||
| } | ||
| } | ||
| }, | ||
| "gitHead": "743b70375f728a1584ae149bbadcd04378540ade" | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
287949
1.12%30
3.45%2372
1.8%