From 0e2da32c2563c321b11511f7a2b3717e482d5710 Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Sat, 30 Sep 2023 10:36:27 -0500 Subject: [PATCH] fix(routing): [closes #168] Construct redirect URL correctly (#170) * docs(readme): add note about syncing forks * fix(routing): use correct pathSegmentsToKeep --- README.md | 4 +++- public/404.html | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7cd2e05..5eb46d1 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,9 @@ Explore the files in `src/config` to modify pairing and relay server configurati ### Troubleshooting -If you run into any issues with a custom Chitchatter installation, first ensure that you are using [the latest version of the code](https://github.com/jeremyckahn/chitchatter/tree/main). +If you run into any issues with a custom Chitchatter installation, first ensure that you are using [the latest version of the code](https://github.com/jeremyckahn/chitchatter/tree/main). If you are hosting your installation with GitHub Pages, sync your `main` branch and _not_ your `gh-pages` branch. Updating your `main` branch will trigger a proper rebuild of your `gh-pages` branch. + +- https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork #### Peers won't connect diff --git a/public/404.html b/public/404.html index e8bdb81..48f96fb 100644 --- a/public/404.html +++ b/public/404.html @@ -24,7 +24,10 @@ // https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes // https://username.github.io/repo-name/?/one/two&a=b~and~c=d#qwe // Otherwise, leave pathSegmentsToKeep as 0. - var pathSegmentsToKeep = 0 + //var pathSegmentsToKeep = 0 + var pathSegmentsToKeep = window.location.origin.endsWith('.github.io') + ? 1 + : 0 var l = window.location l.replace(