fix desktop smzdm csrf publishing
This commit is contained in:
@@ -234,6 +234,20 @@ function classifyDongchediFailure(input: PlatformFailureInput): PlatformFailureC
|
||||
return classifyFailure(input)
|
||||
}
|
||||
|
||||
function classifySmzdmFailure(input: PlatformFailureInput): PlatformFailureClassification {
|
||||
const code = typeof input.error?.code === 'string' ? input.error.code : ''
|
||||
if (code === 'smzdm_not_logged_in' || code === 'smzdm_csrf_missing') {
|
||||
return 'auth_failure'
|
||||
}
|
||||
if (code === 'smzdm_challenge_required') {
|
||||
return 'challenge'
|
||||
}
|
||||
if (code.startsWith('smzdm_')) {
|
||||
return 'ok'
|
||||
}
|
||||
return classifyFailure(input)
|
||||
}
|
||||
|
||||
const aiAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probeAIAccountSession(account, partition)
|
||||
@@ -364,6 +378,16 @@ const dongchediAdapter: PlatformAdapter = {
|
||||
classifyFailure: classifyDongchediFailure,
|
||||
}
|
||||
|
||||
const smzdmAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition)
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshPublishAccountSession(account, partition)
|
||||
},
|
||||
classifyFailure: classifySmzdmFailure,
|
||||
}
|
||||
|
||||
const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
[
|
||||
...aiPlatformCatalog.map((platform) => platform.id),
|
||||
@@ -402,8 +426,10 @@ const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
? weixinGzhAdapter
|
||||
: platform === 'zol'
|
||||
? zolAdapter
|
||||
: platform === 'dongchedi'
|
||||
? dongchediAdapter
|
||||
: platform === 'dongchedi'
|
||||
? dongchediAdapter
|
||||
: platform === 'smzdm'
|
||||
? smzdmAdapter
|
||||
: aiPlatformCatalog.some((item) => item.id === platform)
|
||||
? aiAdapter
|
||||
: genericAdapter,
|
||||
|
||||
Reference in New Issue
Block a user