1
0
mirror of https://github.com/chowa/ejyy.git synced 2026-01-21 05:07:48 +08:00

update config

This commit is contained in:
xuecong
2022-12-06 19:47:14 +08:00
parent 3be31273ae
commit e462dd06f4
9 changed files with 5 additions and 23 deletions

View File

@@ -30,10 +30,6 @@ interface Config {
port: number;
password: string;
};
token: {
mp: string;
pc: string;
};
wechat: {
ump: {
appid: string;
@@ -141,11 +137,6 @@ function generateConfig(): Config {
password: '',
...customConfig.redis
},
token: {
mp: 'ejyy-mp-token',
pc: 'ejyy-pc-token',
...customConfig.token
},
wechat: {
// 小程序
ump: {

View File

@@ -26,7 +26,7 @@ function MpModule(appRouter: KoaRouter) {
appRouter[router.method](path.posix.join('/mp', router.path), async (ctx: Context, next) => {
if (router.authRequired) {
const token = ctx.request.header[config.token.mp];
const token = ctx.request.header['ejyy-mp-token'];
if (!token) {
return (ctx.status = 401);

View File

@@ -29,7 +29,7 @@ function PcModule(appRouter: KoaRouter) {
appRouter[router.method](path.posix.join('/pc', router.path), async (ctx: Context, next) => {
if (router.authRequired) {
const token = ctx.request.header[config.token.pc];
const token = ctx.request.header['ejyy-pc-token'];
if (!token) {
return (ctx.status = 401);

View File

@@ -10,8 +10,6 @@
* +----------------------------------------------------------------------
*/
export const AUTH_HEADER_NAME = 'ejyy-pc-token';
export const TOKEN_ID = 'EJYY_PC_TOKEN';
export const USER_ID = 'EJYY_PC_USER_ID';
@@ -22,8 +20,6 @@ export const DEGAULT_PAGE_SIZE = 10;
export const FORM_ADAPT_WIDTH = 992;
export const WECHAT_WEB_APPID = '';
export const HOST_NAME = '';
export const ASSET_HOST = 'https://assets.ejyy.chowa.cn';

View File

@@ -13,7 +13,6 @@
import axios from 'axios';
import { Message } from 'view-design';
import router from '@/router';
import * as config from '@/config';
import * as utils from '@/utils';
const service = axios.create({
@@ -47,7 +46,7 @@ service.interceptors.request.use(
const token = utils.auth.getToken();
if (token) {
options.headers[config.AUTH_HEADER_NAME] = token;
options.headers['ejyy-pc-token'] = token;
}
options.url = `/pc${options.url}`;

View File

@@ -18,8 +18,6 @@ export const TOKEN_NAME = 'EJYY-TOKEN';
export const USER_ID = 'USER_ID';
export const AUTH_HEADER_NAME = 'ejyy-mp-token';
export const WECHAT_VERSION = '7.0.0';
export const SDK_VERSION = '2.16.0';

View File

@@ -18,7 +18,7 @@ function request({ url, data, method }) {
wx.request({
url: `${config.API_HOST}/mp${url}`,
header: {
[config.AUTH_HEADER_NAME]: storage.token(),
['ejyy-mp-token']: storage.token(),
['wechat-mp-request']: true
},
data,

View File

@@ -18,8 +18,6 @@ export const TOKEN_NAME = 'EJYY-TOKEN';
export const USER_ID = 'USER_ID';
export const AUTH_HEADER_NAME = 'ejyy-pc-token';
export const WECHAT_VERSION = '7.0.0';
export const SDK_VERSION = '2.16.0';

View File

@@ -18,7 +18,7 @@ function request({ url, data, method }) {
wx.request({
url: `${config.API_HOST}/pc${url}`,
header: {
[config.AUTH_HEADER_NAME]: storage.token(),
['ejyy-pc-token']: storage.token(),
['wechat-mp-request']: true
},
data,