Browse Source

忘记更新新上传组队的链接了

tags/v31.1
枫谷剑仙 3 years ago
parent
commit
70dc6718ae
4 changed files with 49 additions and 9 deletions
  1. +1
    -1
      library/zxing.umd.min.js
  2. +1
    -0
      package.json
  3. +45
    -6
      script.js
  4. +2
    -2
      service-worker.js

+ 1
- 1
library/zxing.umd.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
package.json View File

@@ -1,6 +1,7 @@
{
"dependencies": {
"@xmldom/xmldom": "^0.8.2",
"@zxing/library": "^0.19.2",
"mime": "^3.0.0",
"opencc-js": "^1.0.5",
"sharp": "^0.31.0",


+ 45
- 6
script.js View File

@@ -2072,11 +2072,24 @@ function initialize() {
{
imagesSelected(this.files);
}
function imagesSelected(myFiles) {
async function imagesSelected(myFiles) {
if (myFiles.length < 1) return;
const file = myFiles[0];
loadImage(URL.createObjectURL(file)).then(function(img) {
qrcodeReader.decodeFromImage(img).then((result) => {
let img = await loadImage(URL.createObjectURL(file));
let cavans = document.createElement("canvas");
cavans.width = img.width + 100;
cavans.height = img.height + 100;
let ctx = cavans.getContext('2d');
ctx.fillStyle="white";
ctx.fillRect(0, 0, cavans.width, cavans.height);

ctx.drawImage(img, 100, 100);

cavans.toBlob(async function(blob){
let newFileURL = URL.createObjectURL(blob),
newImg = await loadImage(newFileURL);
qrcodeReader.decodeFromImage(newImg).then((result) => {
console.debug('Found QR code!', result);
qrReadBox.qrStr.value = result.text;
qrReadBox.readString.onclick();
@@ -2096,10 +2109,32 @@ function initialize() {
}
}
});
console.debug(`Started decode for image from ${img.src}`)
}, function(err) {
console.debug(err);
console.debug(`Started decode for image from ${newImg.src}`);
});


// qrcodeReader.decodeFromImage(img).then((result) => {
// console.debug('Found QR code!', result);
// qrReadBox.qrStr.value = result.text;
// qrReadBox.readString.onclick();
// }).catch((err) => {
// console.error(err);
// if (err) {
// if (err instanceof ZXing.NotFoundException) {
// qrReadBox.info.show('No QR code found.');
// }
// if (err instanceof ZXing.ChecksumException) {
// qrReadBox.info.show('A code was found, but it\'s read value was not valid.');
// }
// if (err instanceof ZXing.FormatException) {
// qrReadBox.info.show('A code was found, but it was in a invalid format.');
// }
// }
// });
// console.debug(`Started decode for image from ${img.src}`);
}

if (location.protocol == "http:" && location.host != "localhost" && location.host != "127.0.0.1")
@@ -2242,6 +2277,10 @@ function initialize() {
if (response.status === 401) {
alert(localTranslating.link_read_message.paddb_unauthorized);
} else if (response.status === 200) {
if (isNewUpload) {
paddbTeamId.value = response.response;
paddbTeamId.onchange();
}
alert(localTranslating.link_read_message.paddb_success);
} else {
alert(localTranslating.link_read_message.error[0]);


+ 2
- 2
service-worker.js View File

@@ -8091,7 +8091,7 @@ const cachesMap = new Map([
],
[
"script.js",
"afd1b8136c41a5dd3a9a0f062532196b"
"910c1850224619f8c574087b1b5e0e8f"
],
[
"solo.html",
@@ -8315,7 +8315,7 @@ const cachesMap = new Map([
],
[
"library/zxing.umd.min.js",
"1259d50407597e5cd08b72255e33b062"
"8d375c0f8d57d8504a91cbcd9e9fe82d"
],
[
"library/jy4340132-aaa/adpcm.js",


Loading…
Cancel
Save