mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-10-23 00:01:22 +00:00
2fa fixes
This commit is contained in:
3 files changed
+20
-11
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import {BinWrite} from "../utils/binaryUtils.js";
|
||||
import {setTheme} from "../utils/utils.js";
|
||||
import {saveFile, setTheme} from "../utils/utils.js";
|
||||
import {Play} from "./play.js";
|
||||
if (window.location.pathname.startsWith("/audio")) {
|
||||
await setTheme();
|
||||
@@ -179,14 +179,7 @@ if(zip){
|
||||
const download = document.getElementById("download");
|
||||
if (download) {
|
||||
download.onclick = () => {
|
||||
const blob = new Blob([buff], {type: "binary"});
|
||||
const downloadUrl = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = downloadUrl;
|
||||
a.download = "sounds.jasf";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
URL.revokeObjectURL(downloadUrl);
|
||||
saveFile(buff, "sounds.jasf");
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
setPreferences,
|
||||
ThemeOption,
|
||||
} from "./utils/storage/userPreferences";
|
||||
import {createImg, getapiurls, installPGet, setTheme, SW} from "./utils/utils";
|
||||
import {createImg, getapiurls, installPGet, saveFile, setTheme, SW} from "./utils/utils";
|
||||
|
||||
export async function showusersettings(localuser: Localuser) {
|
||||
const prefs = getPreferences();
|
||||
@@ -840,8 +840,14 @@ export async function showusersettings(localuser: Localuser) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
gen2FA();
|
||||
const codes = _.backup_codes as {
|
||||
user_id: string;
|
||||
code: string;
|
||||
consumed: boolean;
|
||||
}[];
|
||||
saveFile(new TextEncoder().encode(JSON.stringify(codes)).buffer, "codes.backup");
|
||||
localuser.mfa_enabled = true;
|
||||
gen2FA();
|
||||
twofa.returnFromSub();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1012,3 +1012,13 @@ export function getInstances() {
|
||||
export function getStringURLMapPair() {
|
||||
return [stringURLMap, stringURLsMap] as const;
|
||||
}
|
||||
export async function saveFile(buff: ArrayBuffer, name: string) {
|
||||
const blob = new Blob([buff], {type: "binary"});
|
||||
const downloadUrl = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = downloadUrl;
|
||||
a.download = name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
URL.revokeObjectURL(downloadUrl);
|
||||
}
|
||||
Reference in new issue
Block a user