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

Feature: URL base/URL subpath support #1131

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Shihira
Copy link

@Shihira Shihira commented Oct 27, 2024

As discussed in issue #163 , the base URL feature is required to host silverbullet through reverse proxy without the need of subdomain, enabling the usage of some port proxy such as ngrok.

In this implementation, the url prefix is read from environment variable SB_URL_PREFIX, and passed to the client by text substitutions in index.html.

I did many coarse batch substitution in like http_sever.ts without fine tests, so it might need to be carefully looked into.

@zefhemel zefhemel self-assigned this Oct 27, 2024
@Shihira
Copy link
Author

Shihira commented Oct 28, 2024

@zefhemel lint problems should be fixed in the appended commit. Restart the check will you please?

@zefhemel
Copy link
Collaborator

Good start, testing this right now let me post my findings:

  1. While clicking page links works, the URL they appear to link to is still on the root (note the URL when you hover over them), likely you'll have to adapt cm_plugins/wiki_link.ts too.

@zefhemel
Copy link
Collaborator

I noticed that I have to prefix my prefix with a / otherwise it doesn't work (I tried SB_URL_PREFIX with website but then found only /website works). This ok, although it may be nice to sanitize this (just add a / if it's not there already)

@zefhemel
Copy link
Collaborator

When I transclude an image or PDF, it renders nicely inline, but when I click the transclusion link it links me to a 404. For instance:

CleanShot 2024-10-28 at 14 37 40@2x

but clicking that link:

CleanShot 2024-10-28 at 14 37 50@2x

@zefhemel
Copy link
Collaborator

zefhemel commented Oct 28, 2024

Using the Navigate: To URL command, injects the url prefix even in external URLs:

{[Navigate: To URL|Community]("https://community.silverbullet.md")}

Sends me to https://community.silverbullet.md/website/ (/website is my configured prefix)

@zefhemel
Copy link
Collaborator

zefhemel commented Oct 28, 2024

Sync mode doesn't seem to work at all (try switching to it by using the Sync button at the top right). And after being in Sync mode, disabling it breaks everything until I manually unregister the service worker.

@Shihira
Copy link
Author

Shihira commented Oct 28, 2024

It seems there is still a long way to go before completely usable. Do I need to work on this alone or the project members will also provide assistance?

@Shihira
Copy link
Author

Shihira commented Oct 28, 2024

I think I am doing it wrong. In most cases urls need to remain relative instead of getting a prefix injection everywhere. I will look into it by weekend.

@Shihira
Copy link
Author

Shihira commented Nov 1, 2024

@zefhemel the latest commit fixes most of the url jumping problems you metioned earlier. And the sync mode appeared to function out of box after I applied the latest upstream update (without any modifications on my end).

@zefhemel
Copy link
Collaborator

Just did a bit more testing and many of the issues I reported remain. Do you need help? I can probably take this over, can't promise immediately though.

@Shihira
Copy link
Author

Shihira commented Nov 12, 2024

Yes please take over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants