Skip to content

Commit

Permalink
fixing path
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonhochkins committed Jul 5, 2024
1 parent 3f5617c commit db7d8dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hakit/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Hakit",
"version": "1.0.24",
"version": "1.0.25",
"slug": "hakit",
"init": false,
"ingress": true,
Expand Down
4 changes: 3 additions & 1 deletion hakit/server/routes/run-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let isAppRunning = false;
export async function runApplication(app: Express) {
const data = await getAddonInfo();
const htmlContent = readFileSync(DEFAULT_HTML_FILE, 'utf8');
const basePath = data?.ingress_url || '/';
const pageContent = htmlContent.replace('{{baseUrl}}', data?.ingress_url || '/');
async function startApp() {
// @ts-expect-error
Expand Down Expand Up @@ -56,9 +57,10 @@ export async function runApplication(app: Express) {
});
app.use((_req, res, next) => {
const nextJsBuilt = existsSync(join(APP_DIRECTORY, 'app', '.next'));
console.log('_req.path', _req.path);
// first check if the current path is the root level
if (!nextJsBuilt && (_req.path === '/' || _req.path === '')) {
res.redirect(data?.ingress_url + '/config');
res.redirect(basePath + 'config');
} else {
next();
}
Expand Down

0 comments on commit db7d8dc

Please sign in to comment.