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

pull/251/head
Sylvie 6 months 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)
// Migrate the datafile (token => uploader)
.then(() => data().get())
.then((fileData: [string, FileData][]) =>
.then(() => (!data())
? (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.
// 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);
}))
.catch((err: any) => log.warn(err.message))
)
// We did it hoofuckingray
.then(() => log.success('Migrated all auth & file data to new auth system'))
.then(() => resolve(newUsers))

Loading…
Cancel
Save