Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yafangsuo_fileHosting
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
yafangsuo_fileHosting
Commits
c02b1b11
Commit
c02b1b11
authored
Nov 29, 2023
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
274dcc5e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
2 deletions
+10
-2
serverConfig.xml
serverConfig.xml
+3
-1
user.ts
src/middleware/user.ts
+1
-1
http_server.ts
src/net/http_server.ts
+5
-0
router.ts
src/routers/router.ts
+1
-0
No files found.
serverConfig.xml
View file @
c02b1b11
<config>
<port>
40004
</port>
<dbPort>
40002
</dbPort>
<dbHost>
localhost
</dbHost>
<dbHost>
192.168.0.71
</dbHost>
<sign>
xxx90909082fsdahfjosadjfpoiwausjorip2hjklrhn1ioud0u124rx0qwejfokasjfolksaujfoas
</sign>
<fileIP>
http://192.168.0.71:40004
</fileIP>
</config>
<!-- -->
\ No newline at end of file
src/middleware/user.ts
View file @
c02b1b11
...
...
@@ -17,7 +17,7 @@ export async function authentication(req, res, next) {
return
next
(
new
BizError
(
ERRORENUM
.
非法登录
,
`上传时候
${
userId
}
${
token
}
`
));
}
if
(
userId
==
"admin"
||
userId
==
"
admin2
"
)
{
if
(
userId
==
"admin"
||
userId
==
"
superAdmin
"
)
{
let
userInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
后台用户表
,
{
uId
:
userId
},
null
);
if
(
!
userInfo
||
!
userInfo
.
uId
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证失败
));
if
(
!
userInfo
.
token
||
userInfo
.
token
!=
token
)
return
next
(
new
BizError
(
ERRORENUM
.
身份验证过期
));
...
...
src/net/http_server.ts
View file @
c02b1b11
...
...
@@ -5,6 +5,8 @@ import compression = require('compression');
import
{
watch
}
from
'../middleware/watch'
;
import
{
httpErrorHandler
}
from
'../middleware/httpErrorHandler'
;
import
{
authentication
}
from
'../middleware/user'
;
import
*
as
path
from
"path"
;
import
*
as
fallback
from
'express-history-api-fallback'
;
export
class
httpServer
{
...
...
@@ -29,6 +31,9 @@ export class httpServer {
httpServer
.
use
(
express
.
static
(
"./files"
)
);
const
root
=
path
.
join
(
__dirname
,
"../../public"
);
httpServer
.
use
(
express
.
static
(
root
));
httpServer
.
use
(
fallback
(
'index.html'
,
{
root
}));
httpServer
.
use
(
compression
());
...
...
src/routers/router.ts
View file @
c02b1b11
...
...
@@ -27,3 +27,4 @@ async function upFiles(req, res) {
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment