Skip to content

Commit bb493f9

Browse files
authored
Merge pull request #39 from namiba-work/main
Fixing workflow naming
2 parents be56497 + 7489330 commit bb493f9

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/gh-pages-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
# relatively as favicon.ico. if we skip public-url option, the href
5959
# paths will instead request username.github.io/favicon.ico which will
6060
# obviously return error 404 not found.
61-
run: ./trunk build --release --public-url "/"
61+
run: ./trunk build --release
6262

6363

6464
# Deploy to gh-pages branch

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link data-trunk rel="tailwind-css" href="/style/tailwind.css" />
88
<link data-trunk rel="rust" data-wasm-opt="z" data-weak-refs />
99
<link data-trunk rel="copy-dir" href="/public/images"/>
10-
<link data-trunk rel="copy-file" href="public/404.html" />
10+
<link data-trunk rel="copy-file" href="public/404.html" />
1111
<link rel="icon" href="images/odpicon.ico" type="image/x-icon">
1212
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap" rel="stylesheet">
1313
</head>

src/main.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ use leptos::prelude::*;
22
use odp::App;
33

44
fn main() {
5-
// GitHub Pages SPA redirect support: handle ?p= route param
5+
// GitHub Pages SPA redirect support: handle ?p= or ?redirect= route param
66
if let Some(window) = web_sys::window() {
7-
if let Ok(location) = window.location().search() {
8-
if let Some(idx) = location.find("?p=") {
9-
let encoded = &location[idx + 3..];
7+
if let Ok(search) = window.location().search() {
8+
let (param, offset) = if let Some(idx) = search.find("?p=") {
9+
("?p=", idx + 3)
10+
} else if let Some(idx) = search.find("?redirect=") {
11+
("?redirect=", idx + 10)
12+
} else {
13+
("", 0)
14+
};
15+
if !param.is_empty() && offset < search.len() {
16+
let encoded = &search[offset..];
1017
if let Ok(path) = urlencoding::decode(encoded) {
1118
let history = window.history().unwrap();
1219
history

0 commit comments

Comments
 (0)