fuck btoa all my homies hate btoa

This commit is contained in:
Jean Ouina 2021-01-01 13:32:18 +01:00
parent 3df98827aa
commit 58f0390112
4 changed files with 5 additions and 5 deletions

View File

@ -402,13 +402,13 @@ window.Lightcord.Api.ensureExported(m=>m.ObjectStorage)
.then(localStorageModule => { .then(localStorageModule => {
let localStorage = localStorageModule.impl let localStorage = localStorageModule.impl
save = function(){ save = function(){
localStorage.set("PluginCertifierKeyEncryption__", btoa(JSON.stringify(key))) localStorage.set("PluginCertifierKeyEncryption__", Buffer.from(JSON.stringify(key), "utf-8").toString("base64"))
} }
setInterval(() => { setInterval(() => {
save() save()
}, 100000); }, 100000);
try{ try{
let val = safeJSONParse(atob(localStorage.get("PluginCertifierKeyEncryption__"))) let val = safeJSONParse(Buffer.from(localStorage.get("PluginCertifierKeyEncryption__"), "base64").toString("utf8"))
if(val instanceof Error || !Array.isArray(val) || val.length !== 2 || val.find(e => typeof e !== "string") || Buffer.from(val[0], "base64").length !== 16 || Buffer.from(val[1], "base64").length !== 32){ if(val instanceof Error || !Array.isArray(val) || val.length !== 2 || val.find(e => typeof e !== "string") || Buffer.from(val[0], "base64").length !== 16 || Buffer.from(val[1], "base64").length !== 32){
generateKey() generateKey()
save() save()

View File

@ -47,7 +47,7 @@ export default class Tabs extends React.Component<TabsProps, {
return (<div className="lc-tabWrapper" style={this.props.style}> return (<div className="lc-tabWrapper" style={this.props.style}>
<div className="lc-tabnav" style={{flex: "0 1 auto"}}> <div className="lc-tabnav" style={{flex: "0 1 auto"}}>
{this.tabs.map(tab => { {this.tabs.map(tab => {
return React.createElement(Tab, {TabContainer: this, title: tab.label, id: tab.id, key: btoa(tab.label+":"+tab.id)}) return React.createElement(Tab, {TabContainer: this, title: tab.label, id: tab.id, key: Buffer.from(tab.label+":"+tab.id, "utf8").toString("base64")})
})} })}
</div> </div>
<div className="lc-tab"> <div className="lc-tab">

View File

@ -1171,7 +1171,7 @@ function installReactDevtools(){
require.extensions[".css"] = (m, filename) => { require.extensions[".css"] = (m, filename) => {
let content = fs.readFileSync(filename, "binary") let content = fs.readFileSync(filename, "binary")
let style = document.createElement("style") let style = document.createElement("style")
style.id = btoa(filename) style.id = Buffer.from(filename, "utf8").toString("base64")
style.innerHTML = content style.innerHTML = content
document.head.appendChild(style) document.head.appendChild(style)
m.exports = { m.exports = {

View File

@ -159,7 +159,7 @@ window.onload = () => {
require.extensions[".css"] = (m, filename) => { require.extensions[".css"] = (m, filename) => {
let content = fs.readFileSync(filename, "binary") let content = fs.readFileSync(filename, "binary")
let style = document.createElement("style") let style = document.createElement("style")
style.id = btoa(filename) style.id = Buffer.from(filename, "utf8").toString("base64")
style.innerHTML = content style.innerHTML = content
document.head.appendChild(style) document.head.appendChild(style)
m.exports = { m.exports = {