yakuza0 2.22.34-beta.13 → 2.22.34-beta.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.22.34-beta.13",
3
+ "version": "2.22.34-beta.14",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,6 +22,7 @@ const setCookie = (key, value, options) => {
22
22
 
23
23
  export default async (ctx, inject) => {
24
24
  const {redirect, $yk, req, res} = ctx
25
+ const appName = $yk.appName;
25
26
 
26
27
  const $redirect = (...args) => {
27
28
  let url = args[0]
@@ -39,13 +40,20 @@ export default async (ctx, inject) => {
39
40
  setCookie(yConf.server.redirect.afkKey, "true", {res, domain: $yk.appConf.cookieDomain})
40
41
 
41
42
  if (typeof url === 'string') {
43
+ const trimPrefix = $yk.hostname && $yk.hostname[appName] && $yk.hostname[appName].value || '__prefix';
44
+ if (_.startsWith(url, trimPrefix)) {
45
+ url = _.replace(url, trimPrefix, '');
46
+
47
+ if (!url.startsWith('/')) {
48
+ url = '/' + url
49
+ }
50
+ }
42
51
  const parse = _.urlParse(url)
43
52
 
44
53
  if (parse.host) {
45
54
  isOuter = true;
46
55
  prefix = parse.protocols ? parse.protocols : 'http://'
47
56
  }
48
-
49
57
  url = prefix + parse.crop
50
58
  }
51
59