Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 71f0c8a

Browse files
Merge branch 'main' into release-please--branches--main--components--space
2 parents 4297aea + bbc72b4 commit 71f0c8a

5 files changed

Lines changed: 30 additions & 18 deletions

File tree

dist/worker.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63760,8 +63760,8 @@ const Get = async (key, pass) => {
6376063760
const s = await r.text();
6376163761
return Space_1.default.API.AES.Decrypt(s, pass);
6376263762
};
63763-
const Put = async (s, pass) => {
63764-
const info = await Space_1.default.API.NPMUpload(Space_1.default.API.AES.Encrypt(s, pass));
63763+
const Put = async (s, pass, time) => {
63764+
const info = await Space_1.default.API.NPMUpload(Space_1.default.API.AES.Encrypt(s, pass), time);
6376563765
if (info.success)
6376663766
return info.key;
6376763767
return null;
@@ -63803,7 +63803,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
6380363803
* ==========================================================================
6380463804
*/
6380563805
const Space_1 = __webpack_require__(7619);
63806-
async function NPMUpload(file) {
63806+
async function NPMUpload(file, time) {
6380763807
let notify = 1;
6380863808
if (typeof file === "string") {
6380963809
const blob = new Blob([Buffer.from(file)], { type: "text/plain" });
@@ -63818,7 +63818,7 @@ async function NPMUpload(file) {
6381863818
const GITHUB_REPO = set.GITHUB_REPO;
6381963819
const GITHUB_BRANCH = set.GITHUB_BRANCH;
6382063820
const NPM_PKG = set.NPM_PKG;
63821-
const message = Date.now();
63821+
const message = time || Date.now();
6382263822
const url = `https://api.github.com/repos/${GITHUB_REPO}/contents/${fileName}?ref=${GITHUB_BRANCH}`;
6382363823
const fileSha = await fetch(url, {
6382463824
method: "GET",
@@ -67221,6 +67221,7 @@ async function update(that) {
6722167221
if (item.errorTime > 0) {
6722267222
return;
6722367223
}
67224+
const index = sub.indexOf(item);
6722467225
const feed = await Space_1.default.API.XML2JSON(item.url);
6722567226
try {
6722667227
if (feed.items[0]?.pubDate != item.lastUpdateTime) {
@@ -67233,7 +67234,7 @@ async function update(that) {
6723367234
lastPost: feed.items[0]?.title,
6723467235
lastLink: feed.items[0]?.link,
6723567236
lastUpdateTime: feed.items[0]?.pubDate,
67236-
lastPostView: await page(feed.items[0]?.title, feed.items[0]?.content)
67237+
lastPostView: await page(feed.items[0]?.title, feed.items[0]?.content, index)
6723767238
};
6723867239
sub = sub.filter((it) => it.url !== item.url);
6723967240
sub.push(rss);
@@ -67271,14 +67272,14 @@ async function update(that) {
6727167272
}
6727267273
return sub;
6727367274
}
67274-
async function page(tittle, content) {
67275+
async function page(title, content, index = 0) {
6727567276
content = content.replace(/<img.*?>/g, "");
6727667277
const html = `<html lang="en">
6727767278
<head>
6727867279
<meta charset="UTF-8">
6727967280
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6728067281
<meta name="viewport" content="width=device-width, initial-scale=1.0">
67281-
<title>${tittle}</title>
67282+
<title>${title}</title>
6728267283
<style>
6728367284
article{
6728467285
margin: 0 auto;
@@ -67288,12 +67289,15 @@ async function page(tittle, content) {
6728867289
</head>
6728967290
<body>
6729067291
<article>
67291-
<h1>${tittle}</h1>
67292+
<h1>${title}</h1>
6729267293
${content}
6729367294
</article>
6729467295
</body>
6729567296
</html>`;
67296-
const key = await Space_1.default.API.NPMData.Put(html, "RssView");
67297+
const key = Date.now();
67298+
setTimeout(async () => {
67299+
await Space_1.default.API.NPMData.Put(html, "RssView", key);
67300+
}, 30000 * index);
6729767301
return "https://" + WORKERROUTE.replace("/*", '') + "/rss-view/" + key;
6729867302
}
6729967303
async function last(that) {
@@ -68940,7 +68944,9 @@ const RSS = async (that) => {
6894068944
}
6894168945
}
6894268946
if (that.args.k == "update") {
68947+
await ctx.reply("Trying to update...");
6894368948
await Space_1.default.Helpers.RSS.update();
68949+
await ctx.reply("Update Done.");
6894468950
}
6894568951
if (that.args.k == "last") {
6894668952
await Space_1.default.Helpers.RSS.last(that);

src/Space/API/NPMData/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const Get = async (key: string, pass: string): Promise<string> => {
3131
const s = await r.text();
3232
return Space.API.AES.Decrypt(s, pass);
3333
}
34-
const Put = async (s: string, pass: string): Promise<string> => {
35-
const info = await Space.API.NPMUpload(Space.API.AES.Encrypt(s, pass))
34+
const Put = async (s: string, pass: string, time?: number): Promise<string> => {
35+
const info = await Space.API.NPMUpload(Space.API.AES.Encrypt(s, pass), time)
3636
if (info.success)
3737
return info.key;
3838
return null;

src/Space/API/NPMUpload/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
import Space from "../../Space"
2323

24-
async function NPMUpload(file: string | File): Promise<{ success: boolean; status: number; key: string; name: string; body: string; }> {
24+
async function NPMUpload(file: string | File, time?: number): Promise<{ success: boolean; status: number; key: string; name: string; body: string; }> {
2525
let notify = 1;
2626
if (typeof file === "string") {
2727
const blob = new Blob([Buffer.from(file)], { type: "text/plain" })
@@ -37,7 +37,7 @@ async function NPMUpload(file: string | File): Promise<{ success: boolean; statu
3737
const GITHUB_REPO = set.GITHUB_REPO;
3838
const GITHUB_BRANCH = set.GITHUB_BRANCH;
3939
const NPM_PKG = set.NPM_PKG;
40-
const message = Date.now()
40+
const message = time || Date.now()
4141
const url = `https://api.github.com/repos/${GITHUB_REPO}/contents/${fileName}?ref=${GITHUB_BRANCH}`
4242
const fileSha = await fetch(url, {
4343
method: "GET",

src/Space/Helpers/RSS/index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ async function update(that?: HandleMessage): Promise<RSSContext[]> {
7474
if (item.errorTime > 0) {
7575
return;
7676
}
77+
const index = sub.indexOf(item);
7778
const feed: any = await Space.API.XML2JSON(item.url);
7879
try {
7980
if (feed.items[0]?.pubDate != item.lastUpdateTime) {
@@ -86,7 +87,7 @@ async function update(that?: HandleMessage): Promise<RSSContext[]> {
8687
lastPost: feed.items[0]?.title,
8788
lastLink: feed.items[0]?.link,
8889
lastUpdateTime: feed.items[0]?.pubDate,
89-
lastPostView: await page(feed.items[0]?.title, feed.items[0]?.content)
90+
lastPostView: await page(feed.items[0]?.title, feed.items[0]?.content, index)
9091
};
9192
sub = sub.filter((it: any) => it.url !== item.url);
9293
sub.push(rss);
@@ -123,14 +124,14 @@ async function update(that?: HandleMessage): Promise<RSSContext[]> {
123124
}
124125
return sub;
125126
}
126-
async function page(tittle: string, content: string): Promise<string> {
127+
async function page(title: string, content: string, index = 0): Promise<string> {
127128
content = content.replace(/<img.*?>/g, "");
128129
const html = `<html lang="en">
129130
<head>
130131
<meta charset="UTF-8">
131132
<meta http-equiv="X-UA-Compatible" content="IE=edge">
132133
<meta name="viewport" content="width=device-width, initial-scale=1.0">
133-
<title>${tittle}</title>
134+
<title>${title}</title>
134135
<style>
135136
article{
136137
margin: 0 auto;
@@ -140,12 +141,15 @@ async function page(tittle: string, content: string): Promise<string> {
140141
</head>
141142
<body>
142143
<article>
143-
<h1>${tittle}</h1>
144+
<h1>${title}</h1>
144145
${content}
145146
</article>
146147
</body>
147148
</html>`;
148-
const key = await Space.API.NPMData.Put(html, "RssView")
149+
const key = Date.now();
150+
setTimeout(async () => {
151+
await Space.API.NPMData.Put(html, "RssView", key)
152+
}, 30000 * index);
149153
return "https://" + WORKERROUTE.replace("/*", '') + "/rss-view/" + key;
150154
}
151155
async function last(that?: HandleMessage): Promise<void> {

src/Space/TelegrafBot/TGBot/Actions/RSS/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ const RSS = async (that: HandleMessage): Promise<void> => {
5151
}
5252
}
5353
if (that.args.k == "update") {
54+
await ctx.reply("Trying to update...")
5455
await Space.Helpers.RSS.update();
56+
await ctx.reply("Update Done.")
5557
}
5658
if (that.args.k == "last") {
5759
await Space.Helpers.RSS.last(that);

0 commit comments

Comments
 (0)