reverse atob and btoa to proper standard (damn dyslexia)

This commit is contained in:
zefie
2023-11-10 15:04:48 -05:00
parent bd26ba8923
commit 87f09ffec1
3 changed files with 19 additions and 19 deletions

View File

@@ -274,7 +274,7 @@ ${thisblock.title}
block += "<td>"
block += `<CENTER>
<IMG SRC="wtv-author:/${atob(thisblock.photo)}">
<IMG SRC="wtv-author:/${btoa(thisblock.photo)}">
</CENTER>
</TD>
</TR>
@@ -470,8 +470,8 @@ this.fs.writeFile(destDir + this.wtvclient.session_store.subscriber_username + '
break;
case "clipart":
this.fs.mkdirSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + atob(thisblock.photo).substr(0, atob(thisblock.photo).lastIndexOf("/")), { recursive: true })
this.fs.copyFile('includes/ServiceVault/wtv-author/' + atob(thisblock.photo), destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + atob(thisblock.photo), (err) => {
this.fs.mkdirSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + btoa(thisblock.photo).substr(0, btoa(thisblock.photo).lastIndexOf("/")), { recursive: true })
this.fs.copyFile('includes/ServiceVault/wtv-author/' + btoa(thisblock.photo), destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + btoa(thisblock.photo), (err) => {
if (err) throw err;
});
block = `<p><TABLE nocolor width=100%>`
@@ -486,7 +486,7 @@ ${thisblock.title}
</TD>
</TR>`
block += `<TR><td><CENTER>
<IMG SRC="${atob(thisblock.photo)}">
<IMG SRC="${btoa(thisblock.photo)}">
</CENTER>
</TD>
</TR>

View File

@@ -83,7 +83,7 @@ class WTVFavorites {
var self = this;
if (folder_templates[folder]) {
Object.keys(folder_templates[folder]).forEach(function (k) {
self.createFavorite(folder_templates[folder][k].title, folder_templates[folder][k].url, folder, (folder_templates[folder][k].image_type == "image/wtv-bitmap") ? atob(folder_templates[folder][k].image) : folder_templates[folder][k].image, folder_templates[folder][k].image_type);
self.createFavorite(folder_templates[folder][k].title, folder_templates[folder][k].url, folder, (folder_templates[folder][k].image_type == "image/wtv-bitmap") ? btoa(folder_templates[folder][k].image) : folder_templates[folder][k].image, folder_templates[folder][k].image_type);
})
}
}
@@ -140,7 +140,7 @@ class WTVFavorites {
var favoritefile = favoriteid + this.favFileExt;
var favoritefileout = folderpath + favoritefile;
if (imagetype != "url")
image = btoa(image);
image = atob(image);
title = decodeURIComponent(title).replaceAll("+", " ");
url = decodeURIComponent(url)

View File

@@ -79,26 +79,26 @@ class WTVShared {
}
}
/**
* CryptoJS implmentation of Base64 Decoder
* @param {string} a Base64 String
* @return {string} Decoded string
*/
atob(a) {
const CryptoJS = require('crypto-js');
const enc = CryptoJS.enc.Base64.parse(a);
return CryptoJS.enc.Utf8.stringify(enc)
}
/**
* CryptoJS implmentation of Base64 Encoder
* @param {string} b String to encode
* @returns {string} Base64 encoded string
*/
atob(a) {
const CryptoJS = require('crypto-js');
const enc = CryptoJS.enc.Utf8.parse(a); // encodedWord Array object
return CryptoJS.enc.Base64.stringify(enc);
}
/**
* CryptoJS implmentation of Base64 Decoder
* @param {string} a Base64 String
* @return {string} Decoded string
*/
btoa(b) {
const CryptoJS = require('crypto-js');
const enc = CryptoJS.enc.Utf8.parse(b); // encodedWord Array object
return CryptoJS.enc.Base64.stringify(enc);
const enc = CryptoJS.enc.Base64.parse(b);
return CryptoJS.enc.Utf8.stringify(enc)
}
/**