fix: anon upload and domain fix for album links (#292)

This commit is contained in:
Zephyrrus 2021-08-22 16:33:28 +03:00 committed by GitHub
parent 0d36d03db6
commit a8b985240d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -21,7 +21,8 @@ class configGET extends Route {
metaThemeColor: Util.config.metaThemeColor, metaThemeColor: Util.config.metaThemeColor,
metaDescription: Util.config.metaDescription, metaDescription: Util.config.metaDescription,
metaKeywords: Util.config.metaKeywords, metaKeywords: Util.config.metaKeywords,
metaTwitterHandle: Util.metaTwitterHandle metaTwitterHandle: Util.metaTwitterHandle,
domain: process.env.domain
} }
}); });
} }

View File

@ -289,10 +289,10 @@ class Util {
const dbFile = await db.table('files') const dbFile = await db.table('files')
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
.where(function() { .where(function() {
if (user === undefined) { if (user) {
this.whereNull('userId');
} else {
this.where('userId', user.id); this.where('userId', user.id);
} else {
this.whereNull('userId');
} }
}) })
.where({ .where({

View File

@ -29,5 +29,12 @@ export const mutations = {
state.chunkSize = config.chunkSize; state.chunkSize = config.chunkSize;
state.publicMode = config.publicMode; state.publicMode = config.publicMode;
state.userAccounts = config.userAccounts; state.userAccounts = config.userAccounts;
state.URL = config.domain;
const lastChar = config.domain.substr(-1);
if (lastChar === '/') {
state.baseURL = `${config.domain}api`;
} else {
state.baseURL = `${config.domain}/api`;
}
} }
}; };