Skip to content
Snippets Groups Projects
Unverified Commit ac50bb92 authored by syuilo's avatar syuilo
Browse files

Resolve #3137

parent 8fd95de2
No related branches found
No related tags found
No related merge requests found
......@@ -110,6 +110,10 @@ drive:
# accessKey: XXX
# secretKey: YYY
# If enabled:
# The first account created is automatically marked as Admin.
autoAdmin: true
#
# Below settings are optional
#
......
......@@ -49,6 +49,8 @@ export default function load() {
if (config.localDriveCapacityMb == null) config.localDriveCapacityMb = 256;
if (config.remoteDriveCapacityMb == null) config.remoteDriveCapacityMb = 8;
if (config.autoAdmin == null) config.autoAdmin = false;
return Object.assign(config, mixin);
}
......
......@@ -58,6 +58,8 @@ export type Source = {
config?: any;
};
autoAdmin?: boolean;
/**
* ゴーストアカウントのID
*/
......
......@@ -67,6 +67,8 @@ export default async (ctx: Koa.Context) => {
return;
}
const usersCount = await User.count({});
// Fetch exist user that same username
const usernameExist = await User
.count({
......@@ -106,6 +108,7 @@ export default async (ctx: Koa.Context) => {
token: secret,
email: null,
password: hash,
isAdmin: config.autoAdmin && usersCount === 0,
profile: {
bio: null,
birthday: null,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment