diff --git a/nuxt.config.js b/nuxt.config.js index 87cf04e..47bfc81 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -83,6 +83,7 @@ export default { ONION_ADMIN_HOST: process.env.BITCART_ADMIN_ONION_HOST || "", ADMIN_HOST: process.env.BITCART_ADMIN_HOST || "localhost:3000", ROOTPATH: process.env.BITCART_STORE_ROOTPATH || "/", + ADMIN_ROOTPATH: process.env.BITCART_ADMIN_ROOTPATH || "/", }, /* ** Plugins to load before mounting the App diff --git a/store/index.js b/store/index.js index c7b60de..b430197 100644 --- a/store/index.js +++ b/store/index.js @@ -59,8 +59,9 @@ export const getters = { : "" }, adminHost({ onion, env }, { onionAdminHost }) { + const rootPath = env.adminRootPath === "/" ? "" : env.adminRootPath return onion && onionAdminHost - ? onionAdminHost + ? onionAdminHost + rootPath : env.adminHost.replace(/^https?:\/\//, "") }, onionURL({ env, path }, { onionHost }) { @@ -115,6 +116,7 @@ export const actions = { onionAdminHost: env.ONION_ADMIN_HOST, adminHost: env.ADMIN_HOST, rootPath: env.ROOTPATH, + adminRootPath: env.ADMIN_ROOTPATH, }) if (req) { commit("onion", req.headers.host.toLowerCase().endsWith(".onion"))