Skip to content

Commit

Permalink
fix: fix resend bug
Browse files Browse the repository at this point in the history
  • Loading branch information
OToNaShiAKi committed May 21, 2022
1 parent 4676b5d commit 9697fab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "material-douden-tool",
"version": "1.1.4",
"version": "1.1.5",
"private": true,
"author": "濯墨",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const Stacks = {
const { code, message } = await SendComment(roomid.id, roomid.msg);
if (code === 10030) {
clearInterval(Stacks.timer);
Stacks.RoomIds.unshift({ id: roomid, msg });
Stacks.timer = setInterval(Stacks.interval, 1000);
Stacks.RoomIds.unshift(roomid);
Stacks.timer = setInterval(Stacks.interval, 1750);
} else if (message === "f") {
await writeFile(
join(app.getPath("exe"), "../forbidden-words.txt"),
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/axios.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import QS from "qs";
import { Bilibili, Music163, MusicQQ, Baidu, API, Login } from "./config";
import { BrowserWindow } from "electron";

export const SendComment = async (roomid, msg) => {
try {
Expand Down Expand Up @@ -56,6 +57,9 @@ export const GetWebSocket = async (roomid) => {
ruid: up_medal && up_medal.uid,
};
} catch (error) {
const wins = BrowserWindow.getAllWindows();
const win = wins[wins.length - 1];
win.webContents.send("CookieOverdue");
return { host_list: [], comments: [], admin: false, roomid };
}
};
Expand Down
11 changes: 1 addition & 10 deletions src/plugins/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import axios from "axios";
import { BrowserWindow } from "electron";

export const Bilibili = axios.create({
baseURL: "https://api.live.bilibili.com/",
Expand All @@ -13,16 +12,8 @@ export const Bilibili = axios.create({
});

Bilibili.interceptors.response.use((response) => {
const {
data,
config: { url },
} = response;
const { data } = response;
if (data.code !== 0 && data.code !== 1200000) {
if (!url.includes("send")) {
const wins = BrowserWindow.getAllWindows();
const win = wins[wins.length - 1];
win.webContents.send("CookieOverdue");
}
throw data;
}
data.data.message = data.message || data.msg;
Expand Down

0 comments on commit 9697fab

Please sign in to comment.