32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
const fs = require('fs')
|
|
const p = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/shared/media.ts'
|
|
const c = fs.readFileSync(p, 'utf8')
|
|
fs.writeFileSync(
|
|
p,
|
|
c.replace(
|
|
'export interface PhotoMeta {\n id: string\n file: string\n at: number\n favorite: boolean\n}',
|
|
'export interface PhotoMeta {\n id: string\n file: string\n at: number\n favorite: boolean\n category: string\n}'
|
|
),
|
|
'utf8'
|
|
)
|
|
|
|
const m = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/main/mediaStore.ts'
|
|
let mc = fs.readFileSync(m, 'utf8')
|
|
mc = mc.replace(
|
|
" const meta: PhotoMeta = { id: `${Date.now()}`, file, at: Date.now(), favorite: false }",
|
|
" const meta: PhotoMeta = { id: `${Date.now()}`, file, at: Date.now(), favorite: false, category: '默认' }"
|
|
)
|
|
mc = mc.replace(
|
|
` removePhoto(id: string): void {`,
|
|
` setCategory(id: string, category: string): void {
|
|
const p = this.photos.find((x) => x.id === id)
|
|
if (!p) return
|
|
p.category = category
|
|
this.save()
|
|
}
|
|
|
|
removePhoto(id: string): void {`
|
|
)
|
|
fs.writeFileSync(m, mc, 'utf8')
|
|
console.log('media store patched')
|