添加网页调试
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
node_modules
|
||||
game-server/dist
|
||||
game-server/logs
|
||||
*.DS_Store
|
||||
.vscode/*
|
||||
|
||||
@@ -6,3 +6,8 @@ export const ENCRYPT_IV = 'f7182j5f04e377ux';
|
||||
export const ENCRYPT_KEY = 'fiqaxijabbantusmprc234fj';
|
||||
|
||||
export const AUTH_SMS_CNT_PER_DAY = 8;
|
||||
|
||||
export const COUNTER = {
|
||||
UID: 'uid',
|
||||
};
|
||||
|
||||
@@ -31,7 +31,8 @@ export class EntryHandler {
|
||||
console.log('user token not found');
|
||||
return {
|
||||
code: 500,
|
||||
error: true
|
||||
error: true,
|
||||
data: 'user token not found'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,11 @@ export default class HomeController extends Controller {
|
||||
const { ctx } = this;
|
||||
ctx.body = await ctx.service.test.sayHi('egg');
|
||||
}
|
||||
|
||||
public async dev() {
|
||||
const { ctx } = this;
|
||||
await ctx.render('index',{
|
||||
title: 'xxx'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@ function aesDecrypt(data, key, iv) {
|
||||
|
||||
module.exports = options => {
|
||||
return async function parmsDecode(ctx: Context, next) {
|
||||
if(ctx.request.url == '/dev') {
|
||||
await next();
|
||||
return;
|
||||
}
|
||||
if (options.threshold && ctx.length < options.threshold) return;
|
||||
const reqBody = ctx.request.body;
|
||||
|
||||
|
||||
6
web-server/app/public/bootstrap.min.css
vendored
Normal file
6
web-server/app/public/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
69
web-server/app/public/index.html
Normal file
69
web-server/app/public/index.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>
|
||||
chatofpinus
|
||||
</title>
|
||||
<link rel="stylesheet" href="bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
<script src="js/lib/jquery-1.8.0.min.js" type="text/javascript">
|
||||
</script>
|
||||
|
||||
<script src="js/lib/build/build.js" type="text/javascript">
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
|
||||
require('boot');
|
||||
</script>
|
||||
<script src="js/client.js">
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app" class="container">
|
||||
<div class="page-header"><h1>调试</h1></div>
|
||||
<div class="row">
|
||||
<div id="loginError"></div>
|
||||
<div class="col-sm-6">
|
||||
<form id="form">
|
||||
<div class="form-group">
|
||||
<label for="uid">uid (chat)</label>
|
||||
<input type="text" class="form-control" id="uid" name="uid" placeholder="uid" value="asd">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="rid">rid (chat)</label>
|
||||
<input type="text" class="form-control" id="rid" name="rid" placeholder="rid" value="123">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="route">接口</label>
|
||||
<input type="text" class="form-control" id="route" name="route" placeholder="接口">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="route">token</label>
|
||||
<input type="text" class="form-control" id="token" name="token" placeholder="token">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="route">serverId</label>
|
||||
<input type="text" class="form-control" id="serverId" name="serverId" placeholder="serverId">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="params">参数</label>
|
||||
<textarea class="form-control" name="params" id="params" cols="30" rows="10"></textarea>
|
||||
</div>
|
||||
<div class="text-right" aria-label="...">
|
||||
<button type="button" id="add" class="btn btn-default btn-l">加入</button>
|
||||
<button type="button" id="remove" class="btn btn-default btn-l" style="display: none;">离开</button>
|
||||
<button type="button" id="send" class="btn btn-primary btn-l">发送</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-6" id="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
6
web-server/app/public/js/lib/component.json
Normal file
6
web-server/app/public/js/lib/component.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "pomelo-client",
|
||||
"description": "pomelo-client",
|
||||
"local": [ "boot" ],
|
||||
"paths": [ "local"]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "pomelo-protocol",
|
||||
"description": "pomelo-protocol",
|
||||
"keywords": [
|
||||
"pomelo",
|
||||
"protocol"
|
||||
],
|
||||
"version": "0.1.3",
|
||||
"main": "lib/protocol.js",
|
||||
"scripts": [
|
||||
"lib/protocol.js"
|
||||
],
|
||||
"repo": "https://github.com/NetEase/pomelo-protocol"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "emitter",
|
||||
"repo": "component/emitter",
|
||||
"description": "Event emitter",
|
||||
"keywords": [
|
||||
"emitter",
|
||||
"events"
|
||||
],
|
||||
"version": "1.1.2",
|
||||
"scripts": [
|
||||
"index.js"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "pomelo-jsclient-websocket",
|
||||
"description": "pomelo-jsclient-websocket",
|
||||
"keywords": [
|
||||
"pomelo",
|
||||
"jsclient",
|
||||
"websocket"
|
||||
],
|
||||
"version": "0.0.1",
|
||||
"main": "lib/pomelo-client.js",
|
||||
"scripts": [
|
||||
"lib/pomelo-client.js"
|
||||
],
|
||||
"repo": "https://github.com/pomelonode/pomelo-jsclient-websocket"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "pomelo-protobuf",
|
||||
"description": "pomelo-protobuf",
|
||||
"keywords": [
|
||||
"pomelo",
|
||||
"protobuf"
|
||||
],
|
||||
"version": "0.2.0",
|
||||
"main": "lib/client/protobuf.js",
|
||||
"scripts": [
|
||||
"lib/client/protobuf.js"
|
||||
],
|
||||
"repo": "https://github.com/pomelonode/pomelo-protobuf"
|
||||
}
|
||||
11
web-server/app/public/js/lib/local/boot/component.json
Normal file
11
web-server/app/public/js/lib/local/boot/component.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "boot",
|
||||
"description": "Main app boot component",
|
||||
"dependencies": {
|
||||
"component/emitter":"master",
|
||||
"NetEase/pomelo-protocol": "master",
|
||||
"pomelonode/pomelo-protobuf": "master",
|
||||
"pomelonode/pomelo-jsclient-websocket": "master"
|
||||
},
|
||||
"scripts": ["index.js"]
|
||||
}
|
||||
183
web-server/app/public/style.css
Normal file
183
web-server/app/public/style.css
Normal file
@@ -0,0 +1,183 @@
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body, #entry {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
body, table {
|
||||
font-family: DejaVu Sans Mono, fixed;
|
||||
font-size: 14pt;
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
#loginView {
|
||||
width: 100%;
|
||||
font-size: 13pt;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#loginTitle {
|
||||
width: 100%;
|
||||
margin-top: 150px;
|
||||
font-size: 50pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#loginView input[type = "text"] {
|
||||
height: 30px;
|
||||
width: 270px;
|
||||
font-size: inherit;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#loginView input[type = "button"] {
|
||||
height: 30px;
|
||||
width: 90px;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
#loginView table {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-top: 10%;
|
||||
}
|
||||
|
||||
#loginView table tr {
|
||||
text-align: center;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
#loginView table tr td {
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
#loginError {
|
||||
text-align: center;
|
||||
font-size: 16pt;
|
||||
color: #ff0000;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#chatHistory {
|
||||
padding-bottom: 5.1em;
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
background: #007077;
|
||||
}
|
||||
|
||||
#toolbar ul {
|
||||
margin: 0;
|
||||
padding: 5px 0 0 6px;
|
||||
height: 35px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#toolbar li {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 0 2em 0 0;
|
||||
}
|
||||
|
||||
#toolbar select {
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
#entry {
|
||||
width: 100%;
|
||||
font-size: inherit;
|
||||
padding: 1em;
|
||||
margin: 0;
|
||||
border-width: 0;
|
||||
outline-width: 0;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.message {
|
||||
margin: 0.1em 0;
|
||||
}
|
||||
|
||||
.message td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.nick {
|
||||
font-weight: bold;
|
||||
padding: 0 1em 0 0.5em;
|
||||
}
|
||||
|
||||
#pop {
|
||||
display: none;
|
||||
background: #fff;
|
||||
width: 260px;
|
||||
height: 152px;
|
||||
border: 1px solid #e0e0e0;
|
||||
font-size: 12px;
|
||||
font-family: DejaVu Sans Mono, fixed;
|
||||
position: fixed;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#popHead {
|
||||
line-height: 40px;
|
||||
background: #E74C65;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
position: relative;
|
||||
font-size: 12px;
|
||||
padding: 0 0 0 10px;
|
||||
}
|
||||
|
||||
#popHead h2 {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
line-height: 40px;
|
||||
height: 32px;
|
||||
margin-top: -12px;
|
||||
}
|
||||
|
||||
#popHead #popClose {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
#popHead a#popClose:hover {
|
||||
color: #f00;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#popContent {
|
||||
padding: 20px 10px;
|
||||
}
|
||||
|
||||
#popIntro {
|
||||
text-align: center;
|
||||
line-height: 160%;
|
||||
margin: 5px 0;
|
||||
color: #000;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#popMore {
|
||||
text-align: right;
|
||||
border-top: 1px solid #ccc;
|
||||
line-height: 24px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
#popMore:hover {
|
||||
color: #f00;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-l {
|
||||
width: 100px;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { Application } from 'egg';
|
||||
export default (app: Application) => {
|
||||
const { controller, router } = app;
|
||||
const tokenParser = app.middleware.tokenParser();
|
||||
router.get('/dev', controller.home.dev);
|
||||
router.get('/', controller.home.index);
|
||||
router.post('/user/getsms', controller.account.getSms);
|
||||
router.post('/user/smslogin', controller.account.smsLogin);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { EggPlugin } from 'egg';
|
||||
|
||||
const plugin: EggPlugin = {
|
||||
// static: true,
|
||||
// nunjucks: {
|
||||
// enable: true,
|
||||
// package: 'egg-view-nunjucks',
|
||||
// },
|
||||
static: true,
|
||||
nunjucks: {
|
||||
enable: true,
|
||||
package: 'egg-view-nunjucks',
|
||||
},
|
||||
cors: {
|
||||
enable: true,
|
||||
package: 'egg-cors',
|
||||
|
||||
8
web-server/package-lock.json
generated
8
web-server/package-lock.json
generated
@@ -4078,6 +4078,14 @@
|
||||
"mz": "^2.7.0"
|
||||
}
|
||||
},
|
||||
"egg-view-nunjucks": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/egg-view-nunjucks/-/egg-view-nunjucks-2.2.0.tgz",
|
||||
"integrity": "sha512-csuqQSFRpR1G+nu8OxDgHDba1v8RVJ8i4fadX66o73mnclKN6EXPdX9c9igegPeXXucUdDAPAHfJo6nZMJaghw==",
|
||||
"requires": {
|
||||
"nunjucks": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"egg-watcher": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npm.taobao.org/egg-watcher/download/egg-watcher-3.1.1.tgz",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"egg-alinode": "^2.0.1",
|
||||
"egg-cors": "^2.2.3",
|
||||
"egg-scripts": "^2.6.0",
|
||||
"egg-view-nunjucks": "^2.2.0",
|
||||
"mongoose": "^5.10.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"underscore": "^1.10.2"
|
||||
|
||||
2
web-server/typings/config/plugin.d.ts
vendored
2
web-server/typings/config/plugin.d.ts
vendored
@@ -14,6 +14,7 @@ import 'egg-schedule';
|
||||
import 'egg-static';
|
||||
import 'egg-jsonp';
|
||||
import 'egg-view';
|
||||
import 'egg-view-nunjucks';
|
||||
import 'egg-cors';
|
||||
import 'egg-alinode';
|
||||
import { EggPluginItem } from 'egg';
|
||||
@@ -31,6 +32,7 @@ declare module 'egg' {
|
||||
static?: EggPluginItem;
|
||||
jsonp?: EggPluginItem;
|
||||
view?: EggPluginItem;
|
||||
nunjucks?: EggPluginItem;
|
||||
cors?: EggPluginItem;
|
||||
alinode?: EggPluginItem;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user