fix: missing `data.json` breaking auth.json migration

pull/251/head
Sylvie 1 year ago
parent 688b199781
commit bf07999ed8
No known key found for this signature in database
GPG Key ID: 75AB0FE5B983A3AF

@ -69,8 +69,9 @@ const migrate = (authFileName = 'auth.json'): Promise<Users> => new Promise(asyn
.catch(reject) .catch(reject)
// Migrate the datafile (token => uploader) // Migrate the datafile (token => uploader)
.then(() => data().get()) .then(() => (!data())
.then((fileData: [string, FileData][]) => ? (log.warn('data.json not found. This may be a new install?'), Promise.resolve())
: data().get().then((fileData: [string, FileData][]) =>
// ! A note about this block. // ! A note about this block.
// I know it's gross. But using Promise.all crashes low-spec servers, so I had to do it this way. Sorry. // I know it's gross. But using Promise.all crashes low-spec servers, so I had to do it this way. Sorry.
@ -100,7 +101,8 @@ const migrate = (authFileName = 'auth.json'): Promise<Users> => new Promise(asyn
runQueue(0); runQueue(0);
})) }))
.catch((err: any) => log.warn(err.message))
)
// We did it hoofuckingray // We did it hoofuckingray
.then(() => log.success('Migrated all auth & file data to new auth system')) .then(() => log.success('Migrated all auth & file data to new auth system'))
.then(() => resolve(newUsers)) .then(() => resolve(newUsers))

Loading…
Cancel
Save