Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sharePath url option setting #1288

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip: another attempt (and use translation syntax this time)
maphew committed Mar 8, 2025
commit bba2f6db64ddd1f5dda3437d03ca70a9ebc6546e
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ const TPL = `
<div class="form-group">
<label>${t("share.share_path")}</label>
<div>
<input type="text" class="form-control share-path" placeholder="/share or / for root">
<input type="text" class="form-control share-path" placeholder="${t("share.share_path_placeholder")}">
</div>
<div class="form-text">
${t("share.share_path_description")}
2 changes: 1 addition & 1 deletion src/services/auth.ts
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {

// Redirect to the share path
log.info(`checkAuth: Redirecting to share path. From: ${req.path}, To: ${sharePath}`);
res.redirect(sharePath);
res.redirect(`${sharePath}/`);
} else {
res.redirect("login");
}
5 changes: 5 additions & 0 deletions src/share/routes.ts
Original file line number Diff line number Diff line change
@@ -210,6 +210,11 @@ function register(router: Router) {
renderNote(shaca.shareRootNote, req, res);
});
} else {
router.get(`${sharePath}`, (req, res, next) => {
// Redirect to the path with trailing slash for consistency
res.redirect(`${sharePath}/`);
});

router.get(`${sharePath}/`, (req, res, next) => {
if (req.path !== `${sharePath}/`) {
res.redirect(`${sharePath}/`);