diff options
| author | navewindre <boneyaard@gmail.com> | 2025-11-11 08:57:25 +0100 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-11-11 08:57:25 +0100 |
| commit | e52a00fad93831dfd7cf6fe9cdec8e1aaa3c2ccb (patch) | |
| tree | c8be7f88360a7cbc57a8dd4dba28c012a178fb53 | |
| parent | ee4ca553a1234f9c5c0584b7897b41049e420685 (diff) | |
fix
| -rw-r--r-- | web/src/jsx.tsx | 4 | ||||
| -rw-r--r-- | web/src/pkg.tsx | 19 | ||||
| -rw-r--r-- | web/src/sidebar.tsx | 3 |
3 files changed, 11 insertions, 15 deletions
diff --git a/web/src/jsx.tsx b/web/src/jsx.tsx index 98ca440..64a8aad 100644 --- a/web/src/jsx.tsx +++ b/web/src/jsx.tsx @@ -44,11 +44,10 @@ export function addRoute( name: string, component: Function ) { let path = name; let wildcard = false; if( path[path.length - 1] === "*" ) { - console.log( "name" ); path = path.substring( 0, path.length - 1 ); wildcard = true; } - + routes[path] = { path, component, wildcard }; } @@ -77,7 +76,6 @@ export function onPostNavigate( callback: Function ) { * replaces the root element with the route component **/ export function navigate( route: string ) { - console.log( route ); let url = new URL( window.location.href ); let cb = routeForPath( route ); url.pathname = route; diff --git a/web/src/pkg.tsx b/web/src/pkg.tsx index 60a51bb..6705982 100644 --- a/web/src/pkg.tsx +++ b/web/src/pkg.tsx @@ -13,18 +13,17 @@ function downloadFile( file: string ) { function urlForHref( href: string, isdir: boolean ) { const url = new URL( window.location.href ); + let path = url.pathname; if( isdir ) { - const path = url.pathname; if( path.endsWith( '/' ) ) { return path + href; } return path + "/" + href; } - let searchParams = url.searchParams.toString(); - searchParams = searchParams.slice( searchParams.indexOf( '/' ) ); - searchParams = searchParams.slice( searchParams.indexOf( '/' ) ); - return "https://networkheaven.net/pkgs" + searchParams + "/" + href; + path = path.slice( path.indexOf( '/pkgs' ) + 5 ); + if( path.endsWith( '/' ) ) + return "https://networkheaven.net/pkgs" + path + "" + href; } interface PkgEntry { @@ -80,7 +79,6 @@ async function getEntries(): Promise<PkgEntry[]> { const pre = pkgBody.find( "pre" )[0].innerText; const ret = []; - console.log( url.pathname ); if( !url.pathname.endsWith( "/pkg/" ) && !url.pathname.endsWith( "/pkg" ) ) { ret.push({ name: '../', @@ -97,7 +95,6 @@ async function getEntries(): Promise<PkgEntry[]> { continue; const entry = entryFromLine( line ); - console.log( entry ); if( entry ) ret.push( entry ); } @@ -114,16 +111,18 @@ function back() { } function PackageEntry( props: any ) { - console.log( props ); const entry = props.entry as PkgEntry; - console.log( urlForHref( entry.name, entry.isdir ) ); return <tr> <td> { entry.name == "../" && <a href='#' onclick={ () => back() } class="package-entry-link"> ../ </a> } - { entry.name != "../" && + { entry.name != "../" && !entry.isdir && + <a href={urlForHref( entry.name, entry.isdir )} class="package-entry-link"> + {entry.name} + </a> } + { entry.name != "../" && entry.isdir && <a href='#' onclick={ () => JSX.navigate( urlForHref( entry.name, entry.isdir ) ) } class="package-entry-link"> {entry.name} </a> } diff --git a/web/src/sidebar.tsx b/web/src/sidebar.tsx index a1b3ad7..ee93706 100644 --- a/web/src/sidebar.tsx +++ b/web/src/sidebar.tsx @@ -25,7 +25,6 @@ function getWeatherCache() { const res = JSON.parse( localStorage.getItem( "weather" ) ); return res; } catch( e ) { - console.log( e ); return null; } } @@ -57,7 +56,7 @@ function Weather() { const humi = weather.current.relative_humidity_2m; return <div id="weather"> <div class="sidebar-row"><h4>weather in </h4> <h4>愛知県、日本:</h4></div> - <div class="sidebar-row"><h4>temperature:</h4><h4><span id="temp">{temp.toString()} </span>°C</h4></div> + <div class="sidebar-row"><h4>temperature:</h4><h4><span id="temp">{temp.toString()}</span>°C</h4></div> <div class="sidebar-row"><h4>wind speed:</h4><h4><span id="wind">{wind.toString()}</span>km/h</h4></div> <div class="sidebar-row"><h4>humidity:</h4><h4><span id="humi">{humi.toString()}</span>%</h4></div> </div> |
