40 lines
1013 B
TypeScript
40 lines
1013 B
TypeScript
import fs from 'node:fs'
|
|
|
|
export default class IosLicenseController {
|
|
/* ================= HELPER ================= */
|
|
|
|
private getBinFiles(dir: string): string[] {
|
|
if (!fs.existsSync(dir)) return []
|
|
|
|
return fs.readdirSync(dir).filter((file) => file.toLowerCase().endsWith('.bin'))
|
|
}
|
|
|
|
private getLicFiles(dir: string): string[] {
|
|
if (!fs.existsSync(dir)) return []
|
|
|
|
return fs.readdirSync(dir).filter((file) => file.toLowerCase().endsWith('.lic'))
|
|
}
|
|
|
|
/* ================= IOS ================= */
|
|
|
|
async getIos() {
|
|
const smbPath = '/ipsteamSMB/IOS/i'
|
|
const localPath = 'storage/ios'
|
|
|
|
const targetPath = fs.existsSync(smbPath) ? smbPath : localPath
|
|
|
|
return this.getBinFiles(targetPath)
|
|
}
|
|
|
|
/* ================= LICENSE ================= */
|
|
|
|
async getLicense() {
|
|
const smbPath = '/ipsteamSMB/IOS/License'
|
|
const localPath = 'storage/license'
|
|
|
|
const targetPath = fs.existsSync(smbPath) ? smbPath : localPath
|
|
|
|
return this.getLicFiles(targetPath)
|
|
}
|
|
}
|