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

fix: webroot not working in archive view #1043

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

edsu
Copy link
Contributor

@edsu edsu commented Dec 30, 2024

Setting the base URL is required for the archived page to render properly when a --webroot is in use.

I tested the use of the webroot by running a local nginx configured to be a reverse proxy (see configuration below) and then running shiori:

go run main.go server --webroot shiori --port 8081

Prior to the fix my archived page looks like this:

Screenshot 2024-12-30 at 2 05 52 PM

And with the fix it looks like this:

Screenshot 2024-12-30 at 2 06 16 PM

I tested without --webroot and confirm that behavior still works.

nginx config

I tested on MacOS by installing nginx brew install nginx and then editing /opt/homebrew/etc/nginx/nginx.conf to look like:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       8080;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location /shiori/ {
          proxy_pass http://localhost:8081/;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    include servers/*;
}

Fixes #1042

Without this the archive page fails to render.
Copy link

codecov bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.28%. Comparing base (306487a) to head (f57e0cd).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1043   +/-   ##
=======================================
  Coverage   34.28%   34.28%           
=======================================
  Files          61       61           
  Lines        5393     5393           
=======================================
  Hits         1849     1849           
  Misses       3320     3320           
  Partials      224      224           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fmartingr fmartingr changed the title Set webroot base in archive view fix: webroot not working in archive view Dec 31, 2024
@fmartingr
Copy link
Member

Thank you for taking care of this! I recall testing this out on my own when I moved the routes around, I need to add a service to the dev compose file to easily test this locally. Thanks!

@fmartingr fmartingr enabled auto-merge (squash) December 31, 2024 08:27
@fmartingr fmartingr disabled auto-merge December 31, 2024 08:27
@fmartingr fmartingr merged commit f23c982 into go-shiori:master Dec 31, 2024
12 of 14 checks passed
@fmartingr fmartingr added this to the 1.7.3 milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

archive view broken when using webroot
2 participants