mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-03-01 00:13:22 +08:00
feat: admin config subscription
This commit is contained in:
@@ -60,6 +60,13 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
adminConfig.ConfigFile = configFile;
|
||||
if (!adminConfig.ConfigSubscribtion) {
|
||||
adminConfig.ConfigSubscribtion = {
|
||||
URL: '',
|
||||
AutoUpdate: false,
|
||||
LastCheck: '',
|
||||
};
|
||||
}
|
||||
|
||||
// 更新订阅配置
|
||||
if (subscriptionUrl !== undefined) {
|
||||
@@ -68,7 +75,6 @@ export async function POST(request: NextRequest) {
|
||||
if (autoUpdate !== undefined) {
|
||||
adminConfig.ConfigSubscribtion.AutoUpdate = autoUpdate;
|
||||
}
|
||||
// 更新最后检查时间 - 使用前端传递的时间或当前时间
|
||||
adminConfig.ConfigSubscribtion.LastCheck = lastCheckTime || '';
|
||||
|
||||
adminConfig = refineConfig(adminConfig);
|
||||
|
||||
@@ -20,9 +20,20 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
const configContent = await response.text();
|
||||
|
||||
// 对 configContent 进行 base58 解码
|
||||
let decodedContent;
|
||||
try {
|
||||
const bs58 = (await import('bs58')).default;
|
||||
const decodedBytes = bs58.decode(configContent);
|
||||
decodedContent = new TextDecoder().decode(decodedBytes);
|
||||
} catch (decodeError) {
|
||||
console.warn('Base58 解码失败,返回原始内容:', decodeError);
|
||||
throw decodeError;
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
configContent,
|
||||
configContent: decodedContent,
|
||||
message: '配置拉取成功'
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user