✌️
This commit is contained in:
		
							parent
							
								
									b9dd2be673
								
							
						
					
					
						commit
						c46850a69a
					
				
					 3 changed files with 20 additions and 4 deletions
				
			
		| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
import * as os from 'os';
 | 
					import * as os from 'os';
 | 
				
			||||||
import version from '../../version';
 | 
					import version from '../../version';
 | 
				
			||||||
import config from '../../conf';
 | 
					import config from '../../conf';
 | 
				
			||||||
 | 
					import Meta from '../models/meta';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @swagger
 | 
					 * @swagger
 | 
				
			||||||
| 
						 | 
					@ -39,6 +40,8 @@ import config from '../../conf';
 | 
				
			||||||
 * @return {Promise<any>}
 | 
					 * @return {Promise<any>}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
module.exports = (params) => new Promise(async (res, rej) => {
 | 
					module.exports = (params) => new Promise(async (res, rej) => {
 | 
				
			||||||
 | 
						const meta = (await Meta.findOne()) || {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res({
 | 
						res({
 | 
				
			||||||
		maintainer: config.maintainer,
 | 
							maintainer: config.maintainer,
 | 
				
			||||||
		version: version,
 | 
							version: version,
 | 
				
			||||||
| 
						 | 
					@ -49,6 +52,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
 | 
				
			||||||
		cpu: {
 | 
							cpu: {
 | 
				
			||||||
			model: os.cpus()[0].model,
 | 
								model: os.cpus()[0].model,
 | 
				
			||||||
			cores: os.cpus().length
 | 
								cores: os.cpus().length
 | 
				
			||||||
		}
 | 
							},
 | 
				
			||||||
 | 
							top_image: meta.top_image
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								src/api/models/meta.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/api/models/meta.ts
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,7 @@
 | 
				
			||||||
 | 
					import db from '../../db/mongodb';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default db.get('meta') as any; // fuck type definition
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export type IMeta = {
 | 
				
			||||||
 | 
						top_image: string;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -113,9 +113,14 @@
 | 
				
			||||||
		this.mode = 'signin';
 | 
							this.mode = 'signin';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.on('mount', () => {
 | 
							this.on('mount', () => {
 | 
				
			||||||
			document.documentElement.style.backgroundImage = 'url("/assets/desktop/index.jpg")';
 | 
								document.documentElement.style.backgroundColor = '#444';
 | 
				
			||||||
			document.documentElement.style.backgroundSize = 'cover';
 | 
					
 | 
				
			||||||
			document.documentElement.style.backgroundPosition = 'center';
 | 
								this.api('meta').then(meta => {
 | 
				
			||||||
 | 
									const img = meta.top_image ? meta.top_image : '/assets/desktop/index.jpg';
 | 
				
			||||||
 | 
									document.documentElement.style.backgroundImage = `url("${ img }")`;
 | 
				
			||||||
 | 
									document.documentElement.style.backgroundSize = 'cover';
 | 
				
			||||||
 | 
									document.documentElement.style.backgroundPosition = 'center';
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			this.api('stats').then(stats => {
 | 
								this.api('stats').then(stats => {
 | 
				
			||||||
				this.update({
 | 
									this.update({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue