Compare commits

...
2 Commits
Author SHA1 Message Date
shanmite ebf7440ef2 fix: 部分动态无法获取描述 2021-07-15 20:08:33 +08:00
shanmite a0e668bcb5 fix: 移除所有GithubAction相关代码 2021-07-15 11:12:35 +08:00
7 changed files with 14 additions and 75 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ cd lottery
进入lottery上一级目录
```bash
docker image rm shanmite/lottery_auto_docker
docker image rm -f shanmite/lottery_auto_docker
rm -rf lottery/
```
-25
View File
@@ -1,31 +1,6 @@
const Base = require("./Base");
const GihubAPI = require("./GithubAPI");
const MyStorage = {
/**
* 初始化dyid.txt
*/
init: () => {
return new Promise((resolve) => {
GihubAPI.listArtifacts().then(async artifact => {
const { id, size_in_bytes } = artifact;
if (size_in_bytes) {
GihubAPI.downloadArtifacts(id).then(async status => {
if (status) {
Base.tooltip.log('存储初始化成功');
} else {
Base.tooltip.log('存储初始化失败');
await Base.createFile('dyid.txt', '', 'a')
}
resolve()
})
} else {
await Base.createFile('dyid.txt', '', 'a')
resolve()
}
})
});
},
/**
* 搜索dyid
* @param {string} dyid
+9 -6
View File
@@ -136,9 +136,9 @@ class Public {
obj.ctrl = (typeof extend_json === 'undefined') ? [] : strToJson(extend_json).ctrl || [];
/* 是否有官方抽奖 */
obj.hasOfficialLottery = (typeof extension === 'undefined') ? false : typeof extension.lott === 'undefined' ? false : true;
const item = cardToJson.item || {};
/* 转发者的描述 */
obj.description = item.content || item.description || '';
const { item = {} } = cardToJson;
/* 转发者的描述 后两个分别是视频动态的描述和视频本身的描述*/
obj.description = item.content || item.description || cardToJson.dynamic || cardToJson.desc || '';
if (obj.type === 1) {
/* 被转发者的UID */
obj.origin_uid = desc.origin.uid;
@@ -160,11 +160,14 @@ class Public {
false : typeof origin_extension.lott === 'undefined' ?
false : true;
const origin = cardToJson.origin || '{}';
const { user, item } = strToJson(origin);
const originToJson = strToJson(origin);
const { user, item } = originToJson;
/* 被转发者的name */
obj.origin_uname = typeof user === 'undefined' ? '' : user.name || user.uname || '';
obj.origin_uname = typeof user === 'undefined'
? '' : user.name || user.uname || '';
/* 被转发者的描述 */
obj.origin_description = typeof item === 'undefined' ? '' : item.content || item.description || '';
obj.origin_description = typeof item === 'undefined'
? '' : item.content || item.description || originToJson.dynamic || originToJson.desc || '';
}
array.push(obj);
});
-12
View File
@@ -1,13 +1,10 @@
const Base = require("./Base");
const BiliAPI = require("./BiliAPI");
const { trigger } = require("./GithubAPI");
const Public = require("./Public");
const GlobalVar = require('./GlobalVar');
const { followWhiteList } = require("./config");
const config = require("./config");
/** Github运行限制时间*/
const MAX_TIME = 6 * 60 * 60 * 1000 - 6 * 60 * 1000;
/**动态偏移量 */
let offset = '0';
@@ -35,15 +32,6 @@ async function getFollowList() {
*/
async function clear() {
const { clear_max_day, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config;
if (!process.env.LOCALLAUNCH) {
setTimeout(() => {
Base.tooltip.log('运行时间超过Actions上限 - 6小时');
Base.tooltip.log('尝试再次触发clear 并中止此任务')
trigger('clear.yml').then(() => {
process.exit(0);
})
}, MAX_TIME);
}
let success = true;
const uid_list = await getFollowList();
if (!clear_remove_dynamic && clear_remove_attention) {
+2 -20
View File
@@ -1,6 +1,5 @@
const Base = require('./Base');
const BiliAPI = require('./BiliAPI');
const GihubAPI = require("./GithubAPI");
const eventBus = require('./eventBus');
const GlobalVar = require('./GlobalVar');
const Public = require('./Public');
@@ -8,12 +7,9 @@ const Monitor = require('./Monitor');
const { sendNotify } = require('./sendNotify');
const config = require('./config');
/** Github运行限制时间*/
const MAX_TIME = 6 * 60 * 60 * 1000 - 6 * 60 * 1000;
async function createRandomDynamic(num) {
Base.tooltip.log(`准备创建${num}条随机动态`);
if (config.create_dy) {
Base.tooltip.log(`准备创建${num}条随机动态`);
const Dynamic = await Public.prototype.checkAllDynamic(GlobalVar.get("myUID"), 1);
if ((Dynamic.allModifyDynamicResArray[0] || { type: 0 }).type === 1) {
for (let index = 0; index < num; index++) {
@@ -59,21 +55,7 @@ function start() {
eventBus.flush();
resolve();
})
if (process.env.LOCALLAUNCH) {
eventBus.emit('Turn_on_the_Monitor');
} else {
setTimeout(() => {
eventBus.emit('Turn_off_the_Monitor', '运行时间超过Actions上限 - 6小时')
}, MAX_TIME);
GihubAPI.hasLotteryRun().then(s => {
if (s) {
Base.tooltip.log("有冲突的工作流故终止此任务");
resolve()
} else {
eventBus.emit('Turn_on_the_Monitor');
}
})
}
eventBus.emit('Turn_on_the_Monitor');
});
}
+1 -9
View File
@@ -1,6 +1,5 @@
const Base = require("./Base");
const GlobalVar = require("./GlobalVar");
const MyStorage = require("./MyStorage");
const config = require("./config");
const key_map = new Map([['DedeUserID', 'myUID'], ['bili_jct', 'csrf']]);
@@ -24,14 +23,7 @@ async function setVariable(cookie, n) {
GlobalVar.set('remoteconfig', await Base.getRemoteConfig());
}
await Base.createDir('dyids');
if (process.env.PAT) {
if (process.env.CI) {
process.env.NUMBER = 1;
}
await MyStorage.init()
} else {
await Base.createFile(n < 2 ? 'dyid.txt' : `dyid${n}.txt`, '', 'a')
}
await Base.createFile(n < 2 ? 'dyid.txt' : `dyid${n}.txt`, '', 'a')
return
}
+1 -2
View File
@@ -8,7 +8,6 @@ module.exports = {
*/
UIDs: [
31252386,
35719643,
689277291
],
@@ -133,7 +132,7 @@ module.exports = {
/**
* 屏蔽词
*/
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号"],
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号", "钓鱼"],
/**
* 取关白名单