mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
fix: remove cors
This commit is contained in:
1 parent
5d9951a3a2
commit
4efce2c6b8
4 files changed
+2
-13
No files matched your search
@@ -11,7 +11,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^11.0.0",
|
"commander": "^11.0.0",
|
||||||
"cors": "^2.8.5",
|
|
||||||
"dockerode": "^3.3.5",
|
"dockerode": "^3.3.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"jsonwebtoken": "^9.0.1",
|
"jsonwebtoken": "^9.0.1",
|
||||||
|
|||||||
@@ -4,11 +4,7 @@ import Session from '../models/session.js'
|
|||||||
import { defaultUser, genSessionJWT } from '../utils/auth.js'
|
import { defaultUser, genSessionJWT } from '../utils/auth.js'
|
||||||
|
|
||||||
export default (server) => {
|
export default (server) => {
|
||||||
const io = new Server(server, {
|
const io = new Server(server)
|
||||||
cors: {
|
|
||||||
origin: '*',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
io.use(async (socket, next) => {
|
io.use(async (socket, next) => {
|
||||||
console.log('Authenticating...')
|
console.log('Authenticating...')
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import express from 'express'
|
|||||||
import http from 'http'
|
import http from 'http'
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
import swaggerUI from 'swagger-ui-express'
|
import swaggerUI from 'swagger-ui-express'
|
||||||
import cors from 'cors'
|
|
||||||
|
|
||||||
import socketServer from './api/socket.js'
|
import socketServer from './api/socket.js'
|
||||||
import connectDB from './db.js'
|
import connectDB from './db.js'
|
||||||
@@ -23,11 +22,6 @@ async function main() {
|
|||||||
const swaggerDocument = YAML.parse(file)
|
const swaggerDocument = YAML.parse(file)
|
||||||
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument))
|
app.use('/api-docs', swaggerUI.serve, swaggerUI.setup(swaggerDocument))
|
||||||
app.use(express.json())
|
app.use(express.json())
|
||||||
app.use(
|
|
||||||
cors({
|
|
||||||
origin: '*',
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.send('Hello World!')
|
res.send('Hello World!')
|
||||||
|
|||||||
@@ -1602,7 +1602,7 @@ cookie@~0.4.1:
|
|||||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432"
|
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432"
|
||||||
integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==
|
integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==
|
||||||
|
|
||||||
cors@^2.8.5, cors@~2.8.5:
|
cors@~2.8.5:
|
||||||
version "2.8.5"
|
version "2.8.5"
|
||||||
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
||||||
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
|
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
|
||||||
|
|||||||
Reference in new issue
Block a user