更新git及依赖

v1
宇天 2020-09-16 14:08:06 +08:00
parent f595a927ce
commit 3d7963e6f5
12 changed files with 18 additions and 35 deletions

View File

@ -10,7 +10,7 @@
const smarty = new libs.Smarty() const smarty = new libs.Smarty()
const jwt = require('./module/jwt') const jwt = require('./module/jwt')
class Controller { export default class Controller {
constructor({ ctx, req, res }) { constructor({ ctx, req, res }) {
this.ctx = ctx this.ctx = ctx
this.name = req.app this.name = req.app
@ -75,5 +75,3 @@ class Controller {
this.response.append('X-debug', msg + '') this.response.append('X-debug', msg + '')
} }
} }
module.exports = Controller

View File

@ -5,9 +5,9 @@
* @version $Id$ * @version $Id$
*/ */
const Cookie = require('http.cookie') import Cookie from 'http.cookie'
module.exports = function(req, res, next) { export default function(req, res, next) {
var cookie = new Cookie(req.origin.req, req.origin.res) var cookie = new Cookie(req.origin.req, req.origin.res)
var domain = this.get('domain') var domain = this.get('domain')
this.__INSTANCE__.cookie = function(key, val, opt) { this.__INSTANCE__.cookie = function(key, val, opt) {

View File

@ -6,7 +6,7 @@
'use strict' 'use strict'
module.exports = function(req, res, next) { export default function(req, res, next) {
var supportCredentials = this.get('supportCredentials') var supportCredentials = this.get('supportCredentials')
var credentialsRule = this.get('credentialsRule') var credentialsRule = this.get('credentialsRule')
var credentialsMaxAge = this.get('credentialsMaxAge') var credentialsMaxAge = this.get('credentialsMaxAge')

View File

@ -6,7 +6,7 @@
*/ */
'use strict' 'use strict'
module.exports = function(req, res, next) { export default function(req, res, next) {
if (!this.__MODULES__[req.app]) { if (!this.__MODULES__[req.app]) {
if (!this.__MODULES__.__error__) { if (!this.__MODULES__.__error__) {
res.error(`The app [${req.app}] not found`, 404) res.error(`The app [${req.app}] not found`, 404)

View File

@ -4,10 +4,10 @@
* @date 2018-07-26 15:50:25 * @date 2018-07-26 15:50:25
* @version $Id$ * @version $Id$
*/ */
const redisStore = require('../module/redis-store') import redisStore from '../module/redis-store'
const nativeStore = require('../module/native-store') import nativeStore from '../module/native-store'
module.exports = function(req, res, next) { export default function(req, res, next) {
var opt = this.get('session') var opt = this.get('session')
var jwt = this.get('jwt') var jwt = this.get('jwt')
var cookie = this.ins('cookie') var cookie = this.ins('cookie')

View File

@ -15,7 +15,7 @@ const sha256 = (str, secret) => {
.replace(/=/g, '') .replace(/=/g, '')
} }
const sign = function(token) { export const sign = function(token) {
// "{"typ":"JWT","alg":"HS256"}" // "{"typ":"JWT","alg":"HS256"}"
// 这里固定使用sha256 // 这里固定使用sha256
var header = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' var header = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'
@ -31,7 +31,7 @@ const sign = function(token) {
return `${header}.${payload}.${auth}` return `${header}.${payload}.${auth}`
} }
const verify = function() { export const verify = function() {
var jwt = this.request.header('authorization') || '' var jwt = this.request.header('authorization') || ''
var secret = this.ctx.get('jwt') var secret = this.ctx.get('jwt')
var auth, token, payload var auth, token, payload
@ -56,8 +56,3 @@ const verify = function() {
} }
return false return false
} }
module.exports = {
verify,
sign
}

View File

@ -6,7 +6,7 @@
*/ */
'use strict' 'use strict'
class Log { export default class Log {
constructor(file = 'run_time.log', dir) { constructor(file = 'run_time.log', dir) {
if (!dir) { if (!dir) {
throw new Error(`agument dir must be a string, but ${typeof dir} given.`) throw new Error(`agument dir must be a string, but ${typeof dir} given.`)
@ -44,5 +44,3 @@ class Log {
) )
} }
} }
module.exports = Log

View File

@ -15,7 +15,7 @@ function hideProperty(host, name, value) {
}) })
} }
class Session { export default class Session {
constructor(store, opt, uuid) { constructor(store, opt, uuid) {
this.opt = opt this.opt = opt
this.uuid = uuid this.uuid = uuid
@ -79,5 +79,3 @@ class Session {
this.store[this.ssid] = {} this.store[this.ssid] = {}
} }
} }
module.exports = Session

View File

@ -6,7 +6,7 @@
*/ */
'use strict' 'use strict'
class Session { export default class Session {
constructor(store, opt, uuid) { constructor(store, opt, uuid) {
this.store = store this.store = store
this.opt = opt this.opt = opt
@ -79,5 +79,3 @@ class Session {
this.store.del(this.ssid) this.store.del(this.ssid)
} }
} }
module.exports = Session

View File

@ -7,7 +7,7 @@
'use strict' 'use strict'
const mailx = require('mailx') const mailx = require('mailx')
class Sendmail { export default class Sendmail {
constructor({ host, port, mail, passwd } = {}) { constructor({ host, port, mail, passwd } = {}) {
if (!host || !port || !mail || !passwd) { if (!host || !port || !mail || !passwd) {
throw new Error('smtp options [host, port, mail, passwd] is required.') throw new Error('smtp options [host, port, mail, passwd] is required.')
@ -44,5 +44,3 @@ class Sendmail {
return defer.promise return defer.promise
} }
} }
module.exports = Sendmail

View File

@ -7,7 +7,7 @@
'use strict' 'use strict'
const init = { export default {
db: {}, db: {},
session: { session: {
type: 'native', // native 或 redis type: 'native', // native 或 redis
@ -48,5 +48,3 @@ const init = {
qq: /^\d{5,12}$/ qq: /^\d{5,12}$/
} }
} }
module.exports = init

View File

@ -7,7 +7,7 @@
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"crypto.js": "^1.3.1", "crypto.js": "^1.3.1",
"es.shim": "^1.1.2", "@bytedo/es.shim": "^1.0.0",
"iofs": "^1.3.2", "iofs": "^1.3.2",
"mysqli": "^3.0.11", "mysqli": "^3.0.11",
"http.request": "^1.1.0", "http.request": "^1.1.0",
@ -20,11 +20,11 @@
"devDependencies": {}, "devDependencies": {},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/yutent/five.git" "url": "https://github.com/bytedo/gmf.core.git"
}, },
"keywords": ["five, fivejs, node-five, five.js, nodejs, mvc, koa, express"], "keywords": ["five, fivejs, node-five, five.js, nodejs, mvc, koa, express"],
"engines": { "engines": {
"node": ">=8.0.0" "node": ">=10.0.0"
}, },
"license": "MIT" "license": "MIT"
} }