@ossy/app 0.6.0 → 0.6.1
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 +39 -0
- package/cli/server.js +2 -2
- package/package.json +3 -2
package/cli/proxy-internal.js
CHANGED
|
@@ -4,6 +4,45 @@ export function ProxyInternal() {
|
|
|
4
4
|
if (!req.originalUrl.startsWith('/@ossy')) {
|
|
5
5
|
return next()
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
// if (req.originalUrl.startsWith('/@ossy/users/me/app-settings') && req.method === 'PATCH') {
|
|
9
|
+
|
|
10
|
+
// if (!req.body) {
|
|
11
|
+
// res.status(400)
|
|
12
|
+
// res.json("Invalid request body")
|
|
13
|
+
// return
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
// const requestedSettings = req.body
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// const expiresMaxAge = 2147483647 // Max age for cookies in milliseconds
|
|
20
|
+
|
|
21
|
+
// const userSettings = JSON.parse(req.signedCookies?.['x-ossy-user-settings'] || '{}')
|
|
22
|
+
|
|
23
|
+
// const updatedSettings = {
|
|
24
|
+
// ...userSettings,
|
|
25
|
+
// ...requestedSettings
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
// res.cookie('x-ossy-user-settings', JSON.stringify(updatedSettings), {
|
|
29
|
+
// httpOnly: true,
|
|
30
|
+
// signed: true,
|
|
31
|
+
// expires: new Date(Date.now() + expiresMaxAge)
|
|
32
|
+
// })
|
|
33
|
+
|
|
34
|
+
// res.status(201)
|
|
35
|
+
// res.json("")
|
|
36
|
+
// return
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
// if (req.originalUrl.startsWith('/@ossy/users/me/app-settings') && req.method === 'GET') {
|
|
40
|
+
// LogService.Info({ message: `[UsersService][HandleUserAppSettings] METHOD ${req.method}` })
|
|
41
|
+
// const userSettings = JSON.parse(req.signedCookies?.['x-ossy-user-settings'] || '{}')
|
|
42
|
+
// res.status(200)
|
|
43
|
+
// res.json(userSettings)
|
|
44
|
+
// return
|
|
45
|
+
// }
|
|
7
46
|
|
|
8
47
|
console.log(`[@ossy/app][proxy] ${req.method} ${req.originalUrl}`)
|
|
9
48
|
|
package/cli/server.js
CHANGED
|
@@ -26,12 +26,12 @@ const middleware = [
|
|
|
26
26
|
express.json({ strict: false }),
|
|
27
27
|
(req, res, next) => {
|
|
28
28
|
const domain = process.env.OSSY_API_URL || 'https://api.ossy.se'
|
|
29
|
-
const url = `${domain}/api/v0/users/me`
|
|
29
|
+
const url = `${domain}/api/v0/users/me/app-settings`
|
|
30
30
|
const headers = { ...(req.headers || {}) } // Clone headers
|
|
31
31
|
|
|
32
32
|
const request = {
|
|
33
33
|
method: req.method,
|
|
34
|
-
headers: JSON.parse(JSON.stringify(
|
|
34
|
+
headers: JSON.parse(JSON.stringify(headers))
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
fetch(url, request)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/app",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"source": "./src/index.js",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
41
41
|
"arg": "^5.0.2",
|
|
42
42
|
"babel-loader": "^9.2.1",
|
|
43
|
+
"cookie-parser": "^1.4.7",
|
|
43
44
|
"express": ">=5.0.0 <6.0.0",
|
|
44
45
|
"morgan": ">=1.10.1 <2.0.0",
|
|
45
46
|
"react": ">=19.0.0 <20.0.0",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"/cli",
|
|
58
59
|
"README.md"
|
|
59
60
|
],
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "109a7e2881f55f5061eccb369ca834ab93ff32f5"
|
|
61
62
|
}
|