mirror of
https://github.com/pionxzh/chatgpt-exporter.git
synced 2026-07-23 09:00:51 -05:00
fix: remove localstorage legacy migrator
This commit is contained in:
@@ -7,7 +7,6 @@ const API_MAPPING: Record<string, string> = {
|
||||
export const baseUrl = new URL(location.href).origin
|
||||
export const apiUrl = API_MAPPING[baseUrl]
|
||||
|
||||
export const LEGACY_KEY_FILENAME_FORMAT = 'exporter-format'
|
||||
export const KEY_LANGUAGE = 'exporter:language'
|
||||
export const KEY_FILENAME_FORMAT = 'exporter:filename_format'
|
||||
export const KEY_OFFICIAL_JSON_FORMAT = 'exporter:official_json_format'
|
||||
|
||||
21
src/main.tsx
21
src/main.tsx
@@ -1,8 +1,6 @@
|
||||
import { render } from 'preact'
|
||||
import sentinel from 'sentinel-js'
|
||||
import { GM_deleteValue, GM_getValue, GM_setValue } from 'vite-plugin-monkey/dist/client'
|
||||
import { fetchConversation, processConversation } from './api'
|
||||
import { KEY_FILENAME_FORMAT, LEGACY_KEY_FILENAME_FORMAT } from './constants'
|
||||
import { getChatIdFromUrl, getConversationChoice, isSharePage } from './page'
|
||||
import { Menu } from './ui/Menu'
|
||||
import { onloadSafe } from './utils/utils'
|
||||
@@ -10,25 +8,6 @@ import { onloadSafe } from './utils/utils'
|
||||
import './i18n'
|
||||
import './styles/missing-tailwind.css'
|
||||
|
||||
/**
|
||||
* Migrate legacy filename format
|
||||
*/
|
||||
try {
|
||||
const legacyFormat = GM_getValue?.(LEGACY_KEY_FILENAME_FORMAT, '')
|
||||
const localLegacyFormat = localStorage.getItem(LEGACY_KEY_FILENAME_FORMAT)
|
||||
if (legacyFormat) {
|
||||
GM_deleteValue?.(LEGACY_KEY_FILENAME_FORMAT)
|
||||
GM_setValue?.(KEY_FILENAME_FORMAT, JSON.stringify(legacyFormat))
|
||||
}
|
||||
else if (localLegacyFormat) {
|
||||
localStorage.removeItem(LEGACY_KEY_FILENAME_FORMAT)
|
||||
localStorage.setItem(KEY_FILENAME_FORMAT, JSON.stringify(localLegacyFormat))
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Failed to migrate legacy filename format', error)
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
function main() {
|
||||
|
||||
Reference in New Issue
Block a user