1
Fork 0

Compare commits

..

No commits in common. "1975a821d6e765040811e5ed12a27d74a9248e39" and "eace9562dd043967a03d98a8dda6a8ee595f3a90" have entirely different histories.

2 changed files with 4 additions and 11 deletions

View File

@ -42,5 +42,5 @@ function generateReplacements(elements: HTMLElement[]): Record<string, string> {
} }
function usernameFromElement(element: HTMLElement): string { function usernameFromElement(element: HTMLElement): string {
return (element.textContent ?? "<unknown>").trim().toLowerCase(); return (element.textContent ?? "<unknown>").trim();
} }

View File

@ -6,7 +6,6 @@ import {
isValidHexColor, isValidHexColor,
isValidTildesUsername, isValidTildesUsername,
} from "../../utilities/exports.js"; } from "../../utilities/exports.js";
import {migrations} from "../../storage/migrations/migrations.js";
import {type SettingProps, Setting} from "./index.js"; import {type SettingProps, Setting} from "./index.js";
async function importFileHandler(event: Event): Promise<void> { async function importFileHandler(event: Event): Promise<void> {
@ -21,11 +20,11 @@ async function importFileHandler(event: Event): Promise<void> {
const reader = new window.FileReader(); const reader = new window.FileReader();
reader.addEventListener("load", async (): Promise<void> => { reader.addEventListener("load", async (): Promise<void> => {
let data: Record<string, any>; let data: unknown;
try { try {
// eslint-disable-next-line @typescript-eslint/no-base-to-string // eslint-disable-next-line @typescript-eslint/no-base-to-string
data = JSON.parse(reader.result!.toString()) as Record<string, any>; data = JSON.parse(reader.result!.toString());
} catch (error: unknown) { } catch (error: unknown) {
log(error, true); log(error, true);
return; return;
@ -36,13 +35,7 @@ async function importFileHandler(event: Event): Promise<void> {
return; return;
} }
// eslint-disable-next-line unicorn/prefer-ternary await browser.storage.sync.set(data);
if (data.version === "1.1.2") {
await migrations[0].migrate(data);
} else {
await browser.storage.sync.set(data);
}
log("Successfully imported your settings, reloading the page to apply."); log("Successfully imported your settings, reloading the page to apply.");
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();