Skip to content

Commit

Permalink
[update] 掲示板が証明書エラーを起こしても無視するように修正。
Browse files Browse the repository at this point in the history
[bugfix] 通信エラーが規定回数を超えた時、ウィンドウに通知されないのを修正
  • Loading branch information
pasta04 committed Jun 1, 2020
1 parent bbc8812 commit 47f92b1
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 15 deletions.
54 changes: 43 additions & 11 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unacast",
"version": "0.4.7",
"version": "0.4.8",
"description": "掲示板のレスをYoutubeコメント風に表示したいという思想の元に開発されるツール",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/main/getRes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export const getRes = async (threadUrl: string, resNum: number): Promise<UserCom
if (globalThis.config.notifyThreadConnectionErrorLimit > 0) {
globalThis.electron.threadConnectionError += 1;
if (globalThis.electron.threadConnectionError >= globalThis.config.notifyThreadConnectionErrorLimit) {
log.info('[getRes] エラー回数超過');

globalThis.electron.threadConnectionError = 0;
return [
{
Expand Down
8 changes: 7 additions & 1 deletion src/main/readBBS/Read5ch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* 5ch互換BBS読み込み用モジュール
*/
import axios, { AxiosRequestConfig } from 'axios';
import https from 'https';
import iconv from 'iconv-lite'; // 文字コード変換用パッケージ
import log from 'electron-log';

Expand Down Expand Up @@ -71,11 +72,16 @@ class Read5ch {
range: 'bytes=' + range + '-',
},
};
const instance = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});

let responseJson;
//掲示板へのリクエスト実行
try {
const response = await axios(options);
const response = await instance(options);

// レスポンスヘッダ表示
const headers: { [key: string]: string } = response.headers;
Expand Down
11 changes: 10 additions & 1 deletion src/main/readBBS/ReadSitaraba.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* したらば読み込み用モジュール
*/
import axios, { AxiosRequestConfig } from 'axios';
import https from 'https';
import iconv from 'iconv-lite'; // 文字コード変換用パッケージ
import log from 'electron-log';
export type ShitarabaResponse = ReturnType<typeof purseResponse>;
Expand Down Expand Up @@ -41,8 +42,16 @@ class ReadSitaraba {
method: 'GET',
responseType: 'arraybuffer',
timeout: 3 * 1000,
headers: {
Accept: '*/*',
},
};
const response = await axios(options);
const instance = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
const response = await instance(options);
// UTF-8に変換
const str = decodeUnicodeStr(iconv.decode(Buffer.from(response.data), 'EUC-JP'));

Expand Down
4 changes: 4 additions & 0 deletions src/main/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ const getResInterval = async (exeId: number) => {
}
}
}
} else if (result.length > 0) {
// 番号が無くて結果が入ってるのは通信エラーメッセージ
sendDomForChatWindow(result);
}
await notifyThreadResLimit();

Expand Down Expand Up @@ -342,6 +345,7 @@ const notifyThreadResLimit = async () => {
*/
const taskScheduler = async (exeId: number) => {
if (globalThis.electron?.commentQueueList?.length > 0) {
log.info(`[taskScheduler] ${globalThis.electron?.commentQueueList?.length}`);
if (globalThis.config.commentProcessType === 0) {
// 一括
let temp = [...globalThis.electron.commentQueueList];
Expand Down

0 comments on commit 47f92b1

Please sign in to comment.