fix: preserve explicit Doodstream web login and reuse OTP sessions
CI / verify (push) Canceled after 0s
CI / verify (push) Canceled after 0s
This commit is contained in:
+6
-16
@@ -25,8 +25,9 @@ const DEFAULT_SETTINGS = {
|
||||
};
|
||||
|
||||
class UploadManager extends EventEmitter {
|
||||
constructor(hosterSettings, globalSettings, accountPools) {
|
||||
constructor(hosterSettings, globalSettings, accountPools, options = {}) {
|
||||
super();
|
||||
this.acquireDoodstreamSession = options.acquireDoodstreamSession || null;
|
||||
this.hosterSettings = hosterSettings || {};
|
||||
this.globalSettings = globalSettings || {};
|
||||
this.accountPools = accountPools || {};
|
||||
@@ -1309,22 +1310,11 @@ class UploadManager extends EventEmitter {
|
||||
await voe.login(task.username, task.password);
|
||||
return voe.upload(task.file, progressCb, signal, throttle);
|
||||
} else if (task.hoster === 'doodstream.com' && task.username) {
|
||||
// Login-path reliability fix: the web-form upload returns the filecode in
|
||||
// an HTML form that comes back empty for large files (doodstream backend
|
||||
// registration timeout). Derive the account's API key from the logged-in
|
||||
// session ONCE per batch and upload via the official API instead — it
|
||||
// returns result[0].filecode directly and has no empty-form failure mode.
|
||||
// Falls back to the web-form upload if no valid key can be derived.
|
||||
const apiKey = await this._resolveDoodstreamApiKey(task);
|
||||
if (apiKey) {
|
||||
this._rotLog('doodstream-via-api', { accountId: task.accountId, fileName: path.basename(task.file) });
|
||||
return uploadFile('doodstream.com', task.file, apiKey, progressCb, signal, throttle, {
|
||||
doodBaseline: await this._getBaseline('doodstream.com', apiKey, signal)
|
||||
});
|
||||
}
|
||||
this._rotLog('doodstream-via-web', { accountId: task.accountId, fileName: path.basename(task.file) });
|
||||
const dood = new DoodstreamUploader();
|
||||
await dood.login(task.username, task.password);
|
||||
const dood = this.acquireDoodstreamSession
|
||||
? await this.acquireDoodstreamSession(task)
|
||||
: new DoodstreamUploader();
|
||||
if (!this.acquireDoodstreamSession) await dood.login(task.username, task.password);
|
||||
return dood.upload(task.file, progressCb, signal, throttle);
|
||||
} else if (task.hoster === 'clouddrop.cc') {
|
||||
const clouddrop = new ClouddropUploader(task.apiKey);
|
||||
|
||||
Reference in New Issue
Block a user