[GH-ISSUE #613] Make noscript mode create noscript links for directories #368

Closed
opened 2026-04-08 16:52:23 +03:00 by zhus · 2 comments
Owner

Originally created by @andoalon on GitHub (Aug 14, 2025).
Original GitHub issue: https://github.com/sigoden/dufs/issues/613

Specific Demand

I was trying out the ?noscript parameter, and it works like a charm, but I found a bit surprising how it behaves when clicking on directories: after the new load, the page goes back to the "normal" mode (with javascript).

If the noscript mode is detected based on the browser/browser settings, this doesn't happen, but I would expect that, at least if I manually specified the ?noscript parameter, that if would carry on to directories I click on.

Implement Suggestion

A basic fix would be to add a ?noscript in render_path_item (noscript.rs), like so:

diff --git SrcPrefix/src/noscript.rs DstPrefix/src/noscript.rs
index d40a0f721973fee3286e764e7c87e7a0c80951e6..ecf295473be4cda41ac0d2896d79b585b80a4dc8 100644
--- SrcPrefix/src/noscript.rs
+++ DstPrefix/src/noscript.rs
@@ -65,7 +65,7 @@ fn render_path_item(path: &PathItem) -> String {
     let mtime = format_mtime(path.mtime).unwrap_or_default();
     let size = format_size(path.size, path.path_type);
 
-    format!("<tr><td><a href=\"{href}{suffix}\">{name}{suffix}</a></td><td>{mtime}</td><td>{size}</td></tr>")
+    format!("<tr><td><a href=\"{href}{suffix}?noscript\">{name}{suffix}</a></td><td>{mtime}</td><td>{size}</td></tr>")
 }
 
 fn format_mtime(mtime: u64) -> Option<String> {

This however does not differentiate between the case in which ?noscript was specified manually and when it was simply detected. I personally don't care about this difference: I would be fully satisfied with the solution I propose, but I wanted to hear your thoughts.

Thank you

Originally created by @andoalon on GitHub (Aug 14, 2025). Original GitHub issue: https://github.com/sigoden/dufs/issues/613 ## Specific Demand <!-- What feature do you need, please describe it in detail. --> I was trying out the `?noscript` parameter, and it works like a charm, but I found a bit surprising how it behaves when clicking on directories: after the new load, the page goes back to the "normal" mode (with javascript). If the noscript mode is detected based on the browser/browser settings, this doesn't happen, but I would expect that, at least if I manually specified the `?noscript` parameter, that if would carry on to directories I click on. ## Implement Suggestion <!-- If you have any suggestion for complete this feature, you can tell us. --> A basic fix would be to add a `?noscript` in `render_path_item` (noscript.rs), like so: ```patch diff --git SrcPrefix/src/noscript.rs DstPrefix/src/noscript.rs index d40a0f721973fee3286e764e7c87e7a0c80951e6..ecf295473be4cda41ac0d2896d79b585b80a4dc8 100644 --- SrcPrefix/src/noscript.rs +++ DstPrefix/src/noscript.rs @@ -65,7 +65,7 @@ fn render_path_item(path: &PathItem) -> String { let mtime = format_mtime(path.mtime).unwrap_or_default(); let size = format_size(path.size, path.path_type); - format!("<tr><td><a href=\"{href}{suffix}\">{name}{suffix}</a></td><td>{mtime}</td><td>{size}</td></tr>") + format!("<tr><td><a href=\"{href}{suffix}?noscript\">{name}{suffix}</a></td><td>{mtime}</td><td>{size}</td></tr>") } fn format_mtime(mtime: u64) -> Option<String> { ``` This however does not differentiate between the case in which `?noscript` was specified manually and when it was simply detected. I personally don't care about this difference: I would be fully satisfied with the solution I propose, but I wanted to hear your thoughts. Thank you
zhus closed this issue 2026-04-08 16:52:23 +03:00
Author
Owner

@sigoden commented on GitHub (Aug 16, 2025):

I don't understand in what situations the noscript parameter needs to be set manually.

<!-- gh-comment-id:3192949306 --> @sigoden commented on GitHub (Aug 16, 2025): I don't understand in what situations the noscript parameter needs to be set manually.
Author
Owner

@andoalon commented on GitHub (Aug 16, 2025):

I don't understand in what situations the noscript parameter needs to be set manually.

To be honest I don't really see too much of a use-case to it, but when I did specify it manually to see how the result looked, I got surprised that it didn't stay the same after opening a directory 🤷🏻‍♂️😅

Thank you for taking a look at this

<!-- gh-comment-id:3193496314 --> @andoalon commented on GitHub (Aug 16, 2025): >I don't understand in what situations the noscript parameter needs to be set manually. To be honest I don't really see too much of a use-case to it, but when I did specify it manually to see how the result looked, I got surprised that it didn't stay the same after opening a directory 🤷🏻‍♂️😅 Thank you for taking a look at this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#368