mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修改初始化判断条件
This commit is contained in:
parent
14b20873c7
commit
6819487a43
|
@ -5,6 +5,7 @@ import * as fs from 'fs';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import UserService from '../services/user';
|
import UserService from '../services/user';
|
||||||
import { celebrate, Joi } from 'celebrate';
|
import { celebrate, Joi } from 'celebrate';
|
||||||
|
import { getFileContentByName } from '../config/util';
|
||||||
const route = Router();
|
const route = Router();
|
||||||
|
|
||||||
export default (app: Router) => {
|
export default (app: Router) => {
|
||||||
|
@ -211,12 +212,14 @@ export default (app: Router) => {
|
||||||
try {
|
try {
|
||||||
const userService = Container.get(UserService);
|
const userService = Container.get(UserService);
|
||||||
const authInfo = await userService.getUserInfo();
|
const authInfo = await userService.getUserInfo();
|
||||||
|
const envDbContent = getFileContentByName(config.envDbFile);
|
||||||
|
|
||||||
let isInitialized = true;
|
let isInitialized = true;
|
||||||
if (
|
if (
|
||||||
!authInfo ||
|
Object.keys(authInfo).length === 2 &&
|
||||||
(Object.keys(authInfo).length === 2 &&
|
|
||||||
authInfo.username === 'admin' &&
|
authInfo.username === 'admin' &&
|
||||||
authInfo.password === 'admin')
|
authInfo.password === 'admin' &&
|
||||||
|
envDbContent.length === 0
|
||||||
) {
|
) {
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import routes from '../api';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import jwt from 'express-jwt';
|
import jwt from 'express-jwt';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { getPlatform, getToken } from '../config/util';
|
import { getFileContentByName, getPlatform, getToken } from '../config/util';
|
||||||
import Container from 'typedi';
|
import Container from 'typedi';
|
||||||
import OpenService from '../services/open';
|
import OpenService from '../services/open';
|
||||||
import rewrite from 'express-urlrewrite';
|
import rewrite from 'express-urlrewrite';
|
||||||
|
@ -90,12 +90,14 @@ export default ({ app }: { app: Application }) => {
|
||||||
}
|
}
|
||||||
const userService = Container.get(UserService);
|
const userService = Container.get(UserService);
|
||||||
const authInfo = await userService.getUserInfo();
|
const authInfo = await userService.getUserInfo();
|
||||||
|
const envDbContent = getFileContentByName(config.envDbFile);
|
||||||
|
|
||||||
let isInitialized = true;
|
let isInitialized = true;
|
||||||
if (
|
if (
|
||||||
!authInfo ||
|
Object.keys(authInfo).length === 2 &&
|
||||||
(Object.keys(authInfo).length === 2 &&
|
|
||||||
authInfo.username === 'admin' &&
|
authInfo.username === 'admin' &&
|
||||||
authInfo.password === 'admin')
|
authInfo.password === 'admin' &&
|
||||||
|
envDbContent.length === 0
|
||||||
) {
|
) {
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,19 @@ import {
|
||||||
Input,
|
Input,
|
||||||
Form,
|
Form,
|
||||||
message,
|
message,
|
||||||
notification,
|
Typography,
|
||||||
Steps,
|
Steps,
|
||||||
Select,
|
Select,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
import { history, Link } from 'umi';
|
import { history } from 'umi';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import { request } from '@/utils/http';
|
import { request } from '@/utils/http';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const { Step } = Steps;
|
const { Step } = Steps;
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
const { Link } = Typography;
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
@ -192,8 +193,14 @@ const Login = () => {
|
||||||
<div className={styles.top} style={{ marginTop: 120 }}>
|
<div className={styles.top} style={{ marginTop: 120 }}>
|
||||||
<div className={styles.header}>
|
<div className={styles.header}>
|
||||||
<span className={styles.title}>恭喜安装完成!</span>
|
<span className={styles.title}>恭喜安装完成!</span>
|
||||||
|
<Link href="https://github.com/whyour/qinglong" target="_blank">
|
||||||
|
Github
|
||||||
|
</Link>
|
||||||
|
<Link href="https://t.me/jiao_long" target="_blank">
|
||||||
|
Telegram频道
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.action}>
|
<div style={{ marginTop: 16 }}>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user