@ossy/app 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/proxy-internal.js +6 -2
- package/package.json +2 -2
package/cli/proxy-internal.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export function ProxyInternal() {
|
|
2
2
|
return (req, res, next) => {
|
|
3
|
+
console.log(`[@ossy/app][proxy] ${req.method} ${req.originalUrl}`)
|
|
3
4
|
|
|
4
5
|
if (!req.originalUrl.startsWith('/@ossy')) {
|
|
5
6
|
return next()
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
const domain = process.env.OSSY_API_URL || 'https://api.ossy.se'
|
|
9
|
-
const url = `${domain}${req.
|
|
10
|
+
const url = `${domain}${req.req.originalUrl?.replace('/@ossy', '/api/v0')}`
|
|
10
11
|
const headers = JSON.parse(JSON.stringify(req.headers)) // Clone headers
|
|
11
12
|
const workspaceId = headers.workspaceId
|
|
12
13
|
|
|
13
14
|
if (workspaceId) {
|
|
14
15
|
headers['workspaceid'] = workspaceId
|
|
15
16
|
}
|
|
17
|
+
|
|
18
|
+
console.log(`[@ossy/app][proxy] workspaceId ${workspaceId}`)
|
|
16
19
|
|
|
17
20
|
const request = {
|
|
18
21
|
method: req.method,
|
|
@@ -38,6 +41,7 @@ export function ProxyInternal() {
|
|
|
38
41
|
res.json("")
|
|
39
42
|
})
|
|
40
43
|
.catch((error) => {
|
|
44
|
+
console.log(`[@ossy/app][proxy][error]`, error)
|
|
41
45
|
const status = error.status
|
|
42
46
|
res.status(status || 500)
|
|
43
47
|
res.json({ message: error.message || 'Internal Server Error' })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"source": "./src/index.js",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"/cli",
|
|
58
58
|
"README.md"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6f4ad84b1ec1b87d688c111dc288452df17d44a4"
|
|
61
61
|
}
|