Browse Source

Add fallback host when config is undefined

pull/46/head
coomdev 2 years ago
parent
commit
7b50fa5a47
  1. 2
      main.meta.js
  2. 4
      main.user.js
  3. 2
      src/utils.ts

2
main.meta.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.144
// @version 0.145
// @description uhh
// @author You
// @match https://boards.4channel.org/*

4
main.user.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.144
// @version 0.145
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -11643,7 +11643,7 @@
let total = 0;
fireNotification("info", `Uploading ${injs.length} files...`);
return await Promise.all(injs.map(async (inj) => {
const ret = await filehosts[csettings2.fhost].uploadFile(await buildPeeFile(inj));
const ret = await filehosts[csettings2.fhost || 0].uploadFile(await buildPeeFile(inj));
fireNotification("info", `Uploaded files [${++total}/${injs.length}] ${ret}`);
return ret;
}));

2
src/utils.ts

@ -182,7 +182,7 @@ export const uploadFiles = async (injs: File[]) => {
let total = 0;
fireNotification('info', `Uploading ${injs.length} files...`);
return await Promise.all(injs.map(async inj => {
const ret = await filehosts[csettings.fhost].uploadFile(await buildPeeFile(inj));
const ret = await filehosts[csettings.fhost || 0].uploadFile(await buildPeeFile(inj));
fireNotification('info', `Uploaded files [${++total}/${injs.length}] ${ret}`);
return ret;
}));

Loading…
Cancel
Save