koishi-plugin-bilibili-notify 3.2.9-alpha.1 → 3.2.9-alpha.3
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/lib/index.js +72 -5
- package/lib/index.mjs +72 -5
- package/lib/static/wordcloud2.min.js +15 -0
- package/package.json +2 -2
- package/readme.md +2 -0
package/lib/index.js
CHANGED
|
@@ -796,6 +796,61 @@ var ComRegister = class {
|
|
|
796
796
|
});
|
|
797
797
|
buffer && await session.send(koishi.h.image(buffer, "image/jpeg"));
|
|
798
798
|
});
|
|
799
|
+
biliCom.subcommand(".wc").action(async ({ session }) => {
|
|
800
|
+
const words = [
|
|
801
|
+
["kq8z1", 57],
|
|
802
|
+
["v2n3a", 142],
|
|
803
|
+
["b7x9p", 13],
|
|
804
|
+
["w4m2s", 199],
|
|
805
|
+
["t1j6u", 85],
|
|
806
|
+
["z8c5l", 120],
|
|
807
|
+
["h3r7y", 34],
|
|
808
|
+
["n6d2q", 178],
|
|
809
|
+
["p9s4e", 66],
|
|
810
|
+
["f2g8b", 101],
|
|
811
|
+
["m5v1k", 12],
|
|
812
|
+
["x7a3w", 154],
|
|
813
|
+
["c4t9z", 47],
|
|
814
|
+
["u1b6n", 193],
|
|
815
|
+
["e8y2h", 23],
|
|
816
|
+
["j3l7p", 88],
|
|
817
|
+
["s6q4d", 132],
|
|
818
|
+
["g9m5x", 59],
|
|
819
|
+
["a2w8c", 175],
|
|
820
|
+
["l5h1v", 99],
|
|
821
|
+
["y7k3t", 41],
|
|
822
|
+
["d4z9u", 186],
|
|
823
|
+
["q1e6j", 27],
|
|
824
|
+
["r8p2s", 112],
|
|
825
|
+
["b3n7f", 73],
|
|
826
|
+
["v6x4m", 160],
|
|
827
|
+
["t9c5w", 53],
|
|
828
|
+
["z2u8h", 141],
|
|
829
|
+
["h5y1j", 36],
|
|
830
|
+
["n7l3s", 190],
|
|
831
|
+
["p4d9g", 18],
|
|
832
|
+
["f1b6a", 124],
|
|
833
|
+
["m8v2x", 62],
|
|
834
|
+
["x3a7c", 157],
|
|
835
|
+
["c6t4u", 44],
|
|
836
|
+
["u9b5e", 183],
|
|
837
|
+
["e2y8k", 29],
|
|
838
|
+
["j1l6q", 91],
|
|
839
|
+
["s8g3m", 138],
|
|
840
|
+
["g5w1t", 55],
|
|
841
|
+
["a7z4h", 172],
|
|
842
|
+
["l2h8p", 97],
|
|
843
|
+
["y5k1n", 39],
|
|
844
|
+
["d7u3f", 188],
|
|
845
|
+
["q4e9v", 21],
|
|
846
|
+
["r1p6x", 117],
|
|
847
|
+
["b8n5c", 70],
|
|
848
|
+
["v3x7w", 163],
|
|
849
|
+
["t6c4a", 49],
|
|
850
|
+
["z9u2j", 146]
|
|
851
|
+
];
|
|
852
|
+
await session.send(/* @__PURE__ */ (0, __satorijs_element_jsx_runtime.jsx)("message", { children: koishi.h.image(await this.ctx.gi.generateWordCloudImg(words, "词云测试"), "image/jpg") }));
|
|
853
|
+
});
|
|
799
854
|
}
|
|
800
855
|
async init(config) {
|
|
801
856
|
this.logger = this.ctx.logger("cr");
|
|
@@ -94330,6 +94385,8 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94330
94385
|
});
|
|
94331
94386
|
}
|
|
94332
94387
|
async generateWordCloudImg(words, masterName) {
|
|
94388
|
+
const fontURL = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "font/HYZhengYuan-75W.ttf"));
|
|
94389
|
+
const wordcloudJS = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "static/wordcloud2.min.js"));
|
|
94333
94390
|
const html = `
|
|
94334
94391
|
<!DOCTYPE html>
|
|
94335
94392
|
<html lang="zh-CN">
|
|
@@ -94339,10 +94396,16 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94339
94396
|
<title>高清词云展示</title>
|
|
94340
94397
|
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">
|
|
94341
94398
|
<style>
|
|
94399
|
+
@font-face {
|
|
94400
|
+
font-family: "Custom Font";
|
|
94401
|
+
src: url(${fontURL});
|
|
94402
|
+
}
|
|
94403
|
+
|
|
94342
94404
|
* {
|
|
94343
94405
|
margin: 0;
|
|
94344
94406
|
padding: 0;
|
|
94345
94407
|
box-sizing: border-box;
|
|
94408
|
+
font-family: \"${this.giConfig.font}\", "Custom Font", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
94346
94409
|
}
|
|
94347
94410
|
|
|
94348
94411
|
html {
|
|
@@ -94396,7 +94459,7 @@ var GenerateImg = class extends koishi.Service {
|
|
|
94396
94459
|
</div>
|
|
94397
94460
|
</div>
|
|
94398
94461
|
|
|
94399
|
-
<script src="
|
|
94462
|
+
<script src="${wordcloudJS}"></script>
|
|
94400
94463
|
<script>
|
|
94401
94464
|
const canvas = document.getElementById('wordCloudCanvas');
|
|
94402
94465
|
const ctx = canvas.getContext('2d');
|
|
@@ -94678,6 +94741,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
94678
94741
|
this.cacheable = new CacheableLookup();
|
|
94679
94742
|
this.cacheable.install(node_http.default.globalAgent);
|
|
94680
94743
|
this.cacheable.install(node_https.default.globalAgent);
|
|
94744
|
+
this.jar = new tough_cookie.CookieJar();
|
|
94681
94745
|
await this.createNewClient();
|
|
94682
94746
|
await this.loadCookiesFromDatabase();
|
|
94683
94747
|
this.updateJob = new cron.CronJob("0 0 * * *", async () => {
|
|
@@ -94901,7 +94965,6 @@ var BiliAPI = class extends koishi.Service {
|
|
|
94901
94965
|
}
|
|
94902
94966
|
async createNewClient() {
|
|
94903
94967
|
const wrapper = (await import("axios-cookiejar-support")).wrapper;
|
|
94904
|
-
this.jar = new tough_cookie.CookieJar();
|
|
94905
94968
|
this.client = wrapper(axios.default.create({
|
|
94906
94969
|
jar: this.jar,
|
|
94907
94970
|
headers: {
|
|
@@ -94915,7 +94978,6 @@ var BiliAPI = class extends koishi.Service {
|
|
|
94915
94978
|
getCookies() {
|
|
94916
94979
|
try {
|
|
94917
94980
|
const cookies = this.jar.serializeSync().cookies.map((cookie) => {
|
|
94918
|
-
if (!cookie.expires) cookie.expires = "Infinity";
|
|
94919
94981
|
return cookie;
|
|
94920
94982
|
});
|
|
94921
94983
|
return JSON.stringify(cookies);
|
|
@@ -94995,10 +95057,15 @@ var BiliAPI = class extends koishi.Service {
|
|
|
94995
95057
|
httpOnly = cookieData.httpOnly;
|
|
94996
95058
|
sameSite = cookieData.sameSite;
|
|
94997
95059
|
}
|
|
95060
|
+
const cdExpires = (() => {
|
|
95061
|
+
if (!cookieData.expires) return "Infinity";
|
|
95062
|
+
if (cookieData.expires !== "Infinity") return luxon.DateTime.fromISO(cookieData.expires).toJSDate();
|
|
95063
|
+
return cookieData.expires;
|
|
95064
|
+
})();
|
|
94998
95065
|
const cookie = new tough_cookie.Cookie({
|
|
94999
95066
|
key: cookieData.key,
|
|
95000
95067
|
value: cookieData.value,
|
|
95001
|
-
expires:
|
|
95068
|
+
expires: cdExpires,
|
|
95002
95069
|
domain: cookieData.domain,
|
|
95003
95070
|
path: cookieData.path,
|
|
95004
95071
|
secure: cookieData.secure,
|
|
@@ -95064,7 +95131,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
95064
95131
|
const encrypted = new Uint8Array(await node_crypto.default.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, data$1));
|
|
95065
95132
|
return encrypted.reduce((str, c$1) => str + c$1.toString(16).padStart(2, "0"), "");
|
|
95066
95133
|
}
|
|
95067
|
-
const ts = luxon.DateTime.now().
|
|
95134
|
+
const ts = luxon.DateTime.now().toMillis();
|
|
95068
95135
|
const correspondPath = await getCorrespondPath(ts);
|
|
95069
95136
|
const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
|
|
95070
95137
|
const { document: document$1 } = new jsdom.JSDOM(refreshCsrfHtml).window;
|
package/lib/index.mjs
CHANGED
|
@@ -798,6 +798,61 @@ var ComRegister = class {
|
|
|
798
798
|
});
|
|
799
799
|
buffer && await session.send(h.image(buffer, "image/jpeg"));
|
|
800
800
|
});
|
|
801
|
+
biliCom.subcommand(".wc").action(async ({ session }) => {
|
|
802
|
+
const words = [
|
|
803
|
+
["kq8z1", 57],
|
|
804
|
+
["v2n3a", 142],
|
|
805
|
+
["b7x9p", 13],
|
|
806
|
+
["w4m2s", 199],
|
|
807
|
+
["t1j6u", 85],
|
|
808
|
+
["z8c5l", 120],
|
|
809
|
+
["h3r7y", 34],
|
|
810
|
+
["n6d2q", 178],
|
|
811
|
+
["p9s4e", 66],
|
|
812
|
+
["f2g8b", 101],
|
|
813
|
+
["m5v1k", 12],
|
|
814
|
+
["x7a3w", 154],
|
|
815
|
+
["c4t9z", 47],
|
|
816
|
+
["u1b6n", 193],
|
|
817
|
+
["e8y2h", 23],
|
|
818
|
+
["j3l7p", 88],
|
|
819
|
+
["s6q4d", 132],
|
|
820
|
+
["g9m5x", 59],
|
|
821
|
+
["a2w8c", 175],
|
|
822
|
+
["l5h1v", 99],
|
|
823
|
+
["y7k3t", 41],
|
|
824
|
+
["d4z9u", 186],
|
|
825
|
+
["q1e6j", 27],
|
|
826
|
+
["r8p2s", 112],
|
|
827
|
+
["b3n7f", 73],
|
|
828
|
+
["v6x4m", 160],
|
|
829
|
+
["t9c5w", 53],
|
|
830
|
+
["z2u8h", 141],
|
|
831
|
+
["h5y1j", 36],
|
|
832
|
+
["n7l3s", 190],
|
|
833
|
+
["p4d9g", 18],
|
|
834
|
+
["f1b6a", 124],
|
|
835
|
+
["m8v2x", 62],
|
|
836
|
+
["x3a7c", 157],
|
|
837
|
+
["c6t4u", 44],
|
|
838
|
+
["u9b5e", 183],
|
|
839
|
+
["e2y8k", 29],
|
|
840
|
+
["j1l6q", 91],
|
|
841
|
+
["s8g3m", 138],
|
|
842
|
+
["g5w1t", 55],
|
|
843
|
+
["a7z4h", 172],
|
|
844
|
+
["l2h8p", 97],
|
|
845
|
+
["y5k1n", 39],
|
|
846
|
+
["d7u3f", 188],
|
|
847
|
+
["q4e9v", 21],
|
|
848
|
+
["r1p6x", 117],
|
|
849
|
+
["b8n5c", 70],
|
|
850
|
+
["v3x7w", 163],
|
|
851
|
+
["t6c4a", 49],
|
|
852
|
+
["z9u2j", 146]
|
|
853
|
+
];
|
|
854
|
+
await session.send(/* @__PURE__ */ jsx("message", { children: h.image(await this.ctx.gi.generateWordCloudImg(words, "词云测试"), "image/jpg") }));
|
|
855
|
+
});
|
|
801
856
|
}
|
|
802
857
|
async init(config) {
|
|
803
858
|
this.logger = this.ctx.logger("cr");
|
|
@@ -94332,6 +94387,8 @@ var GenerateImg = class extends Service {
|
|
|
94332
94387
|
});
|
|
94333
94388
|
}
|
|
94334
94389
|
async generateWordCloudImg(words, masterName) {
|
|
94390
|
+
const fontURL = pathToFileURL(resolve$1(__dirname, "font/HYZhengYuan-75W.ttf"));
|
|
94391
|
+
const wordcloudJS = pathToFileURL(resolve$1(__dirname, "static/wordcloud2.min.js"));
|
|
94335
94392
|
const html = `
|
|
94336
94393
|
<!DOCTYPE html>
|
|
94337
94394
|
<html lang="zh-CN">
|
|
@@ -94341,10 +94398,16 @@ var GenerateImg = class extends Service {
|
|
|
94341
94398
|
<title>高清词云展示</title>
|
|
94342
94399
|
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">
|
|
94343
94400
|
<style>
|
|
94401
|
+
@font-face {
|
|
94402
|
+
font-family: "Custom Font";
|
|
94403
|
+
src: url(${fontURL});
|
|
94404
|
+
}
|
|
94405
|
+
|
|
94344
94406
|
* {
|
|
94345
94407
|
margin: 0;
|
|
94346
94408
|
padding: 0;
|
|
94347
94409
|
box-sizing: border-box;
|
|
94410
|
+
font-family: \"${this.giConfig.font}\", "Custom Font", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
94348
94411
|
}
|
|
94349
94412
|
|
|
94350
94413
|
html {
|
|
@@ -94398,7 +94461,7 @@ var GenerateImg = class extends Service {
|
|
|
94398
94461
|
</div>
|
|
94399
94462
|
</div>
|
|
94400
94463
|
|
|
94401
|
-
<script src="
|
|
94464
|
+
<script src="${wordcloudJS}"></script>
|
|
94402
94465
|
<script>
|
|
94403
94466
|
const canvas = document.getElementById('wordCloudCanvas');
|
|
94404
94467
|
const ctx = canvas.getContext('2d');
|
|
@@ -94680,6 +94743,7 @@ var BiliAPI = class extends Service {
|
|
|
94680
94743
|
this.cacheable = new CacheableLookup();
|
|
94681
94744
|
this.cacheable.install(http.globalAgent);
|
|
94682
94745
|
this.cacheable.install(https.globalAgent);
|
|
94746
|
+
this.jar = new CookieJar();
|
|
94683
94747
|
await this.createNewClient();
|
|
94684
94748
|
await this.loadCookiesFromDatabase();
|
|
94685
94749
|
this.updateJob = new CronJob("0 0 * * *", async () => {
|
|
@@ -94903,7 +94967,6 @@ var BiliAPI = class extends Service {
|
|
|
94903
94967
|
}
|
|
94904
94968
|
async createNewClient() {
|
|
94905
94969
|
const wrapper = (await import("axios-cookiejar-support")).wrapper;
|
|
94906
|
-
this.jar = new CookieJar();
|
|
94907
94970
|
this.client = wrapper(axios.create({
|
|
94908
94971
|
jar: this.jar,
|
|
94909
94972
|
headers: {
|
|
@@ -94917,7 +94980,6 @@ var BiliAPI = class extends Service {
|
|
|
94917
94980
|
getCookies() {
|
|
94918
94981
|
try {
|
|
94919
94982
|
const cookies = this.jar.serializeSync().cookies.map((cookie) => {
|
|
94920
|
-
if (!cookie.expires) cookie.expires = "Infinity";
|
|
94921
94983
|
return cookie;
|
|
94922
94984
|
});
|
|
94923
94985
|
return JSON.stringify(cookies);
|
|
@@ -94997,10 +95059,15 @@ var BiliAPI = class extends Service {
|
|
|
94997
95059
|
httpOnly = cookieData.httpOnly;
|
|
94998
95060
|
sameSite = cookieData.sameSite;
|
|
94999
95061
|
}
|
|
95062
|
+
const cdExpires = (() => {
|
|
95063
|
+
if (!cookieData.expires) return "Infinity";
|
|
95064
|
+
if (cookieData.expires !== "Infinity") return DateTime.fromISO(cookieData.expires).toJSDate();
|
|
95065
|
+
return cookieData.expires;
|
|
95066
|
+
})();
|
|
95000
95067
|
const cookie = new Cookie({
|
|
95001
95068
|
key: cookieData.key,
|
|
95002
95069
|
value: cookieData.value,
|
|
95003
|
-
expires:
|
|
95070
|
+
expires: cdExpires,
|
|
95004
95071
|
domain: cookieData.domain,
|
|
95005
95072
|
path: cookieData.path,
|
|
95006
95073
|
secure: cookieData.secure,
|
|
@@ -95066,7 +95133,7 @@ var BiliAPI = class extends Service {
|
|
|
95066
95133
|
const encrypted = new Uint8Array(await crypto.subtle.encrypt({ name: "RSA-OAEP" }, publicKey, data$1));
|
|
95067
95134
|
return encrypted.reduce((str, c$1) => str + c$1.toString(16).padStart(2, "0"), "");
|
|
95068
95135
|
}
|
|
95069
|
-
const ts = DateTime.now().
|
|
95136
|
+
const ts = DateTime.now().toMillis();
|
|
95070
95137
|
const correspondPath = await getCorrespondPath(ts);
|
|
95071
95138
|
const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
|
|
95072
95139
|
const { document: document$1 } = new JSDOM(refreshCsrfHtml).window;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minified by jsDelivr using Terser v5.39.0.
|
|
3
|
+
* Original file: /npm/wordcloud@1.1.2/src/wordcloud2.js
|
|
4
|
+
*
|
|
5
|
+
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
|
6
|
+
*/
|
|
7
|
+
/*!
|
|
8
|
+
* wordcloud2.js
|
|
9
|
+
* http://timdream.org/wordcloud2.js/
|
|
10
|
+
*
|
|
11
|
+
* Copyright 2011 - 2019 Tim Guan-tin Chien and contributors.
|
|
12
|
+
* Released under the MIT license
|
|
13
|
+
*/
|
|
14
|
+
"use strict";window.setImmediate||(window.setImmediate=window.msSetImmediate||window.webkitSetImmediate||window.mozSetImmediate||window.oSetImmediate||function(){if(!window.postMessage||!window.addEventListener)return null;var t=[void 0],e="zero-timeout-message";return window.addEventListener("message",(function(a){if("string"==typeof a.data&&a.data.substr(0,20)===e){a.stopImmediatePropagation();var r=parseInt(a.data.substr(20),36);t[r]&&(t[r](),t[r]=void 0)}}),!0),window.clearImmediate=function(e){t[e]&&(t[e]=void 0)},function(a){var r=t.length;return t.push(a),window.postMessage(e+r.toString(36),"*"),r}}()||function(t){window.setTimeout(t,0)}),window.clearImmediate||(window.clearImmediate=window.msClearImmediate||window.webkitClearImmediate||window.mozClearImmediate||window.oClearImmediate||function(t){window.clearTimeout(t)}),function(t){var e=function(){var t=document.createElement("canvas");if(!t||!t.getContext)return!1;var e=t.getContext("2d");return!!e&&(!!e.getImageData&&(!!e.fillText&&(!!Array.prototype.some&&!!Array.prototype.push)))}(),a=function(){if(e){for(var t,a,r=document.createElement("canvas").getContext("2d"),i=20;i;){if(r.font=i.toString(10)+"px sans-serif",r.measureText("W").width===t&&r.measureText("m").width===a)return i+1;t=r.measureText("W").width,a=r.measureText("m").width,i--}return 0}}(),r=function(t){for(var e,a,r=t.length;r;)e=Math.floor(Math.random()*r),a=t[--r],t[r]=t[e],t[e]=a;return t},i=function(t,i){if(e){Array.isArray(t)||(t=[t]),t.forEach((function(e,a){if("string"==typeof e){if(t[a]=document.getElementById(e),!t[a])throw new Error("The element id specified is not found.")}else if(!e.tagName&&!e.appendChild)throw new Error("You must pass valid HTML elements, or ID of the element.")}));var o={list:[],fontFamily:'"Trebuchet MS", "Heiti TC", "微軟正黑體", "Arial Unicode MS", "Droid Fallback Sans", sans-serif',fontWeight:"normal",color:"random-dark",minSize:0,weightFactor:1,clearCanvas:!0,backgroundColor:"#fff",gridSize:8,drawOutOfBound:!1,shrinkToFit:!1,origin:null,drawMask:!1,maskColor:"rgba(255,0,0,0.3)",maskGapWidth:.3,wait:0,abortThreshold:0,abort:function(){},minRotation:-Math.PI/2,maxRotation:Math.PI/2,rotationSteps:0,shuffle:!0,rotateRatio:.1,shape:"circle",ellipticity:.65,classes:null,hover:null,click:null};if(i)for(var n in i)n in o&&(o[n]=i[n]);if("function"!=typeof o.weightFactor){var s=o.weightFactor;o.weightFactor=function(t){return t*s}}if("function"!=typeof o.shape)switch(o.shape){case"circle":default:o.shape="circle";break;case"cardioid":o.shape=function(t){return 1-Math.sin(t)};break;case"diamond":o.shape=function(t){var e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))};break;case"square":o.shape=function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))};break;case"triangle-forward":o.shape=function(t){var e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))};break;case"triangle":case"triangle-upright":o.shape=function(t){var e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))};break;case"pentagon":o.shape=function(t){var e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))};break;case"star":o.shape=function(t){var e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}}o.gridSize=Math.max(Math.floor(o.gridSize),4);var f,l,d,c,h,u,m,w,g=o.gridSize,v=g-o.maskGapWidth,M=Math.abs(o.maxRotation-o.minRotation),p=Math.abs(Math.floor(o.rotationSteps)),x=Math.min(o.maxRotation,o.minRotation);switch(o.color){case"random-dark":m=function(){return A(10,50)};break;case"random-light":m=function(){return A(50,90)};break;default:"function"==typeof o.color&&(m=o.color)}"function"==typeof o.fontWeight&&(w=o.fontWeight);var b=null;"function"==typeof o.classes&&(b=o.classes);var T,k=!1,I=[],y=function(t){var e,a,r=t.currentTarget,i=r.getBoundingClientRect();t.touches?(e=t.touches[0].clientX,a=t.touches[0].clientY):(e=t.clientX,a=t.clientY);var o=e-i.left,n=a-i.top,s=Math.floor(o*(r.width/i.width||1)/g),f=Math.floor(n*(r.height/i.height||1)/g);return I[s][f]},C=function(t){var e=y(t);T!==e&&(T=e,e?o.hover(e.item,e.dimension,t):o.hover(void 0,void 0,t))},S=function(t){var e=y(t);e&&(o.click(e.item,e.dimension,t),t.preventDefault())},E=[],F=function(t){if(E[t])return E[t];var e=8*t,a=e,r=[];for(0===t&&r.push([c[0],c[1],0]);a--;){var i=1;"circle"!==o.shape&&(i=o.shape(a/e*2*Math.PI)),r.push([c[0]+t*i*Math.cos(-a/e*2*Math.PI),c[1]+t*i*Math.sin(-a/e*2*Math.PI)*o.ellipticity,a/e*2*Math.PI])}return E[t]=r,r},P=function(){return o.abortThreshold>0&&(new Date).getTime()-u>o.abortThreshold},R=function(e,a,r,i,o){if(!(e>=l||a>=d||e<0||a<0)){if(f[e][a]=!1,r)t[0].getContext("2d").fillRect(e*g,a*g,v,v);k&&(I[e][a]={item:o,dimension:i})}},O=function e(i){var n,s,c;Array.isArray(i)?(n=i[0],s=i[1]):(n=i.word,s=i.weight,c=i.attributes);var u=0===o.rotateRatio||Math.random()>o.rotateRatio?0:0===M?x:p>0?x+Math.floor(Math.random()*p)*M/(p-1):x+Math.random()*M,v=function(t,e,r){var i=o.weightFactor(e);if(i<=o.minSize)return!1;var n,s=1;i<a&&(s=function(){for(var t=2;t*i<a;)t+=2;return t}()),n=w?w(t,e,i):o.fontWeight;var f=document.createElement("canvas"),l=f.getContext("2d",{willReadFrequently:!0});l.font=n+" "+(i*s).toString(10)+"px "+o.fontFamily;var d=l.measureText(t).width/s,c=Math.max(i*s,l.measureText("m").width,l.measureText("W").width)/s,h=d+2*c,u=3*c,m=Math.ceil(h/g),v=Math.ceil(u/g);h=m*g,u=v*g;var M=-d/2,p=.4*-c,x=Math.ceil((h*Math.abs(Math.sin(r))+u*Math.abs(Math.cos(r)))/g),b=Math.ceil((h*Math.abs(Math.cos(r))+u*Math.abs(Math.sin(r)))/g),T=b*g,k=x*g;f.setAttribute("width",T),f.setAttribute("height",k),l.scale(1/s,1/s),l.translate(T*s/2,k*s/2),l.rotate(-r),l.font=n+" "+(i*s).toString(10)+"px "+o.fontFamily,l.fillStyle="#000",l.textBaseline="middle",l.fillText(t,M*s,(p+.5*i)*s);var I=l.getImageData(0,0,T,k).data;if(P())return!1;for(var y,C,S,E=[],F=b,R=[x/2,b/2,x/2,b/2];F--;)for(y=x;y--;){S=g;t:for(;S--;)for(C=g;C--;)if(I[4*((y*g+S)*T+(F*g+C))+3]){E.push([F,y]),F<R[3]&&(R[3]=F),F>R[1]&&(R[1]=F),y<R[0]&&(R[0]=y),y>R[2]&&(R[2]=y);break t}}return{mu:s,occupied:E,bounds:R,gw:b,gh:x,fillTextOffsetX:M,fillTextOffsetY:p,fillTextWidth:d,fillTextHeight:c,fontSize:i}}(n,s,u);if(!v)return!1;if(P())return!1;if(!o.drawOutOfBound&&!o.shrinkToFit){var T=v.bounds;if(T[1]-T[3]+1>l||T[2]-T[0]+1>d)return!1}for(var I=h+1,y=function(e){var a=Math.floor(e[0]-v.gw/2),r=Math.floor(e[1]-v.gh/2);v.gw,v.gh;return!!function(t,e,a,r,i){for(var n=i.length;n--;){var s=t+i[n][0],c=e+i[n][1];if(s>=l||c>=d||s<0||c<0){if(!o.drawOutOfBound)return!1}else if(!f[s][c])return!1}return!0}(a,r,0,0,v.occupied)&&(function(e,a,r,i,n,s,f,l,d){var c,h,u,v=r.fontSize;c=m?m(i,n,v,s,f):o.color,h=w?w(i,n,v):o.fontWeight,u=b?b(i,n,v):o.classes,t.forEach((function(t){if(t.getContext){var n=t.getContext("2d"),s=r.mu;n.save(),n.scale(1/s,1/s),n.font=h+" "+(v*s).toString(10)+"px "+o.fontFamily,n.fillStyle=c,n.translate((e+r.gw/2)*g*s,(a+r.gh/2)*g*s),0!==l&&n.rotate(-l),n.textBaseline="middle",n.fillText(i,r.fillTextOffsetX*s,(r.fillTextOffsetY+.5*v)*s),n.restore()}else{var f=document.createElement("span"),m="";m="rotate("+-l/Math.PI*180+"deg) ",1!==r.mu&&(m+="translateX(-"+r.fillTextWidth/4+"px) scale("+1/r.mu+")");var w={position:"absolute",display:"block",font:h+" "+v*r.mu+"px "+o.fontFamily,left:(e+r.gw/2)*g+r.fillTextOffsetX+"px",top:(a+r.gh/2)*g+r.fillTextOffsetY+"px",width:r.fillTextWidth+"px",height:r.fillTextHeight+"px",lineHeight:v+"px",whiteSpace:"nowrap",transform:m,webkitTransform:m,msTransform:m,transformOrigin:"50% 40%",webkitTransformOrigin:"50% 40%",msTransformOrigin:"50% 40%"};for(var M in c&&(w.color=c),f.textContent=i,w)f.style[M]=w[M];if(d)for(var p in d)f.setAttribute(p,d[p]);u&&(f.className+=u),t.appendChild(f)}}))}(a,r,v,n,s,h-I,e[2],u,c),function(e,a,r,i,n,s){var f,c,h=n.occupied,u=o.drawMask;if(u&&((f=t[0].getContext("2d")).save(),f.fillStyle=o.maskColor),k){var m=n.bounds;c={x:(e+m[3])*g,y:(a+m[0])*g,w:(m[1]-m[3]+1)*g,h:(m[2]-m[0]+1)*g}}for(var w=h.length;w--;){var v=e+h[w][0],M=a+h[w][1];v>=l||M>=d||v<0||M<0||R(v,M,u,c,s)}u&&f.restore()}(a,r,0,0,v,i),!0)};I--;){var C=F(h-I);if(o.shuffle&&(C=[].concat(C),r(C)),C.some(y))return!0}return!!o.shrinkToFit&&(Array.isArray(i)?i[1]=3*i[1]/4:i.weight=3*i.weight/4,e(i))},z=function(e,a,r){if(a)return!t.some((function(t){var a=new CustomEvent(e,{detail:r||{}});return!t.dispatchEvent(a)}),this);t.forEach((function(t){var a=new CustomEvent(e,{detail:r||{}});t.dispatchEvent(a)}),this)};!function(){var e=t[0];if(e.getContext)l=Math.ceil(e.width/g),d=Math.ceil(e.height/g);else{var a=e.getBoundingClientRect();l=Math.ceil(a.width/g),d=Math.ceil(a.height/g)}if(z("wordcloudstart",!0)){var r,i,n,s,m;if(c=o.origin?[o.origin[0]/g,o.origin[1]/g]:[l/2,d/2],h=Math.floor(Math.sqrt(l*l+d*d)),f=[],!e.getContext||o.clearCanvas)for(t.forEach((function(t){if(t.getContext){var e=t.getContext("2d");e.fillStyle=o.backgroundColor,e.clearRect(0,0,l*(g+1),d*(g+1)),e.fillRect(0,0,l*(g+1),d*(g+1))}else t.textContent="",t.style.backgroundColor=o.backgroundColor,t.style.position="relative"})),r=l;r--;)for(f[r]=[],i=d;i--;)f[r][i]=!0;else{var w=document.createElement("canvas").getContext("2d");w.fillStyle=o.backgroundColor,w.fillRect(0,0,1,1);var v,M,p=w.getImageData(0,0,1,1).data,x=e.getContext("2d").getImageData(0,0,l*g,d*g).data;for(r=l;r--;)for(f[r]=[],i=d;i--;){M=g;t:for(;M--;)for(v=g;v--;)for(n=4;n--;)if(x[4*((i*g+M)*l*g+(r*g+v))+n]!==p[n]){f[r][i]=!1;break t}!1!==f[r][i]&&(f[r][i]=!0)}x=w=p=void 0}if(o.hover||o.click){for(k=!0,r=l+1;r--;)I[r]=[];o.hover&&e.addEventListener("mousemove",C),o.click&&(e.addEventListener("click",S),e.style.webkitTapHighlightColor="rgba(0, 0, 0, 0)"),e.addEventListener("wordcloudstart",(function t(){e.removeEventListener("wordcloudstart",t),e.removeEventListener("mousemove",C),e.removeEventListener("click",S),T=void 0}))}n=0,0!==o.wait?(s=window.setTimeout,m=window.clearTimeout):(s=window.setImmediate,m=window.clearImmediate);var b=function(e,a){t.forEach((function(t){t.removeEventListener(e,a)}),this)},y=function t(){b("wordcloudstart",t),m(E)};!function(e,a){t.forEach((function(t){t.addEventListener(e,a)}),this)}("wordcloudstart",y);var E=s((function t(){if(n>=o.list.length)return m(E),z("wordcloudstop",!1),void b("wordcloudstart",y);u=(new Date).getTime();var e=O(o.list[n]),a=!z("wordclouddrawn",!0,{item:o.list[n],drawn:e});if(P()||a)return m(E),o.abort(),z("wordcloudabort",!1),z("wordcloudstop",!1),void b("wordcloudstart",y);n++,E=s(t,o.wait)}),o.wait)}}()}function A(t,e){return"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)"}};i.isSupported=e,i.minFontSize=a,"function"==typeof define&&define.amd?(t.WordCloud=i,define("wordcloud",[],(function(){return i}))):"undefined"!=typeof module&&module.exports?module.exports=i:t.WordCloud=i}(this);
|
|
15
|
+
//# sourceMappingURL=/sm/17285da6aeb6fe7b274092d2bc30636118c0f9bda249638730ef2e0e61d54dcf.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-bilibili-notify",
|
|
3
3
|
"description": "Koishi bilibili notify plugin",
|
|
4
|
-
"version": "3.2.9-alpha.
|
|
4
|
+
"version": "3.2.9-alpha.3",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Akokko <admin@akokko.com>"
|
|
7
7
|
],
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"globals": "^16.2.0",
|
|
65
65
|
"koishi": "^4.18.8",
|
|
66
66
|
"koishi-plugin-puppeteer": "^3.9.0",
|
|
67
|
-
"tsdown": "^0.12.
|
|
67
|
+
"tsdown": "^0.12.9",
|
|
68
68
|
"tsx": "^4.20.3",
|
|
69
69
|
"typescript": "5.8.3"
|
|
70
70
|
},
|
package/readme.md
CHANGED
|
@@ -302,6 +302,8 @@ uid为必填参数,为要推送的UP主的UID,index为可选参数,为要
|
|
|
302
302
|
> [!CAUTION]
|
|
303
303
|
> - ver 3.2.9-alpha.0 新增:弹幕词云; 不建议更新,目前仅做测试用!
|
|
304
304
|
> - ver 3.2.9-alpha.1 修复:弹幕词云显示问题,弹幕过多导致插件爆炸; 不建议更新,目前仅做测试用!
|
|
305
|
+
> - ver 3.2.9-alpha.2 修复:`AxiosError: Request failed with status code 404 xxx at async BiliAPI.checkIfTokenNeedRefresh`、潜在cookie相关bug、弹幕词云bug `Error: 生成图片失败!错误: TimeoutError: Navigation timeout of 30000 ms exceeded`
|
|
306
|
+
> - ver 3.2.9-alpha.3 修复:词云生成空白
|
|
305
307
|
|
|
306
308
|
|
|
307
309
|
## 交流群
|