Resolve #3137
This commit is contained in:
		
							parent
							
								
									8fd95de25b
								
							
						
					
					
						commit
						ac50bb9225
					
				
					 4 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -110,6 +110,10 @@ drive:
 | 
				
			||||||
  #   accessKey: XXX
 | 
					  #   accessKey: XXX
 | 
				
			||||||
  #   secretKey: YYY
 | 
					  #   secretKey: YYY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# If enabled:
 | 
				
			||||||
 | 
					#  The first account created is automatically marked as Admin.
 | 
				
			||||||
 | 
					autoAdmin: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Below settings are optional
 | 
					# Below settings are optional
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,8 @@ export default function load() {
 | 
				
			||||||
	if (config.localDriveCapacityMb == null) config.localDriveCapacityMb = 256;
 | 
						if (config.localDriveCapacityMb == null) config.localDriveCapacityMb = 256;
 | 
				
			||||||
	if (config.remoteDriveCapacityMb == null) config.remoteDriveCapacityMb = 8;
 | 
						if (config.remoteDriveCapacityMb == null) config.remoteDriveCapacityMb = 8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (config.autoAdmin == null) config.autoAdmin = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return Object.assign(config, mixin);
 | 
						return Object.assign(config, mixin);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,6 +58,8 @@ export type Source = {
 | 
				
			||||||
		config?: any;
 | 
							config?: any;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						autoAdmin?: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * ゴーストアカウントのID
 | 
						 * ゴーストアカウントのID
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,6 +67,8 @@ export default async (ctx: Koa.Context) => {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const usersCount = await User.count({});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Fetch exist user that same username
 | 
						// Fetch exist user that same username
 | 
				
			||||||
	const usernameExist = await User
 | 
						const usernameExist = await User
 | 
				
			||||||
		.count({
 | 
							.count({
 | 
				
			||||||
| 
						 | 
					@ -106,6 +108,7 @@ export default async (ctx: Koa.Context) => {
 | 
				
			||||||
		token: secret,
 | 
							token: secret,
 | 
				
			||||||
		email: null,
 | 
							email: null,
 | 
				
			||||||
		password: hash,
 | 
							password: hash,
 | 
				
			||||||
 | 
							isAdmin: config.autoAdmin && usersCount === 0,
 | 
				
			||||||
		profile: {
 | 
							profile: {
 | 
				
			||||||
			bio: null,
 | 
								bio: null,
 | 
				
			||||||
			birthday: null,
 | 
								birthday: null,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue