Skip to content

Commit ca478dd

Browse files
committed
updates
1 parent 4d64882 commit ca478dd

9 files changed

Lines changed: 881 additions & 8 deletions

File tree

‎readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ JWT, OpenAPI, HPACK, QPACK — is built on what is in the box.
2323
| [Shiny.Net.HttpServer.DocumentDb](https://www.nuget.org/packages/Shiny.Net.HttpServer.DocumentDb) | Publishes a Shiny.DocumentDb type as a REST resource — list, by-id, count, CRUD, merge-patch and a live SSE tail |
2424
| [Shiny.Net.HttpServer.WebDav](https://www.nuget.org/packages/Shiny.Net.HttpServer.WebDav) | A WebDAV (RFC 4918) class 1 & 2 server over a directory — mount an app's storage in Finder, Windows Explorer or any WebDAV client |
2525
| [Shiny.Net.HttpServer.Grpc](https://www.nuget.org/packages/Shiny.Net.HttpServer.Grpc) | gRPC and gRPC-Web — unary, streaming and bidirectional methods over the same HTTP/2 stack, with serialization you supply |
26-
| [Shiny.Net.HttpServer.CommandLine](https://www.nuget.org/packages/Shiny.Net.HttpServer.CommandLine) | A .NET tool — `shinyhttpserver` — that serves a directory over HTTP with the file browser, with basic auth and per-operation permissions |
26+
| [Shiny.Net.HttpServer.CommandLine](https://www.nuget.org/packages/Shiny.Net.HttpServer.CommandLine) | A .NET tool — `shinyhttpserver` — that serves a directory over HTTP with the file browser, with basic auth, per-operation permissions, and a QR code of the LAN address in the banner so a phone can scan its way in |
2727

2828
## Getting Started
2929

‎skills/shiny-httpserver/SKILL.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ triggers:
9797
- Shiny.Net.HttpServer.CommandLine
9898
- shinyhttpserver
9999
- serve a directory from the command line
100+
- QR code in the terminal
101+
- open a served directory on a phone
100102
- Shiny.Net.HttpServer.WebDav
101103
- MapWebDav
102104
- WebDavOptions
@@ -203,6 +205,10 @@ dotnet tool install -g Shiny.Net.HttpServer.CommandLine # `shinyhttpserver`, no
203205
`Shiny.Net.HttpServer.CommandLine` is a .NET tool, not something an app references: it serves a
204206
directory over HTTP from a terminal (`shinyhttpserver [path] -m read|create|update|delete|all
205207
-u user:password`). Reach for it when the ask is "serve this folder", not "add a server to my app".
208+
It listens on every interface by default and ends its banner with a scannable QR code of the LAN
209+
address plus the URL in full, so "get this folder onto my phone" is the tool answer, not code —
210+
`-a localhost` keeps it to the machine, `--no-qr` drops the code. Basic auth (`-u`) over plain HTTP
211+
refuses to start on a non-loopback address, which the default now is: pair it with `--https`.
206212

207213
## The four tiers — the spine of this library
208214

‎src/Shiny.Net.HttpServer.CommandLine/Cli.cs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public static RootCommand Build(Func<ServeSettings, CancellationToken, Task<int>
3030

3131
var addressOpt = new Option<IPAddress>("--address", "-a")
3232
{
33-
Description = "Address to bind: an IP, 'any' (all interfaces) or 'localhost'.",
33+
Description = "Address to bind: an IP, 'any' (all interfaces) or 'localhost'. Defaults to every interface so other devices can reach it.",
3434
HelpName = "address",
35-
DefaultValueFactory = _ => IPAddress.Loopback,
35+
DefaultValueFactory = _ => IPAddress.Any,
3636
CustomParser = ParseAddress
3737
};
3838

@@ -96,6 +96,11 @@ public static RootCommand Build(Func<ServeSettings, CancellationToken, Task<int>
9696
CustomParser = ParseSize
9797
};
9898

99+
var noQrOpt = new Option<bool>("--no-qr")
100+
{
101+
Description = "Leaves the QR code out of the banner."
102+
};
103+
99104
var verboseOpt = new Option<bool>("--verbose", "-v")
100105
{
101106
Description = "Logs every request."
@@ -115,6 +120,7 @@ public static RootCommand Build(Func<ServeSettings, CancellationToken, Task<int>
115120
httpsOpt,
116121
hiddenOpt,
117122
maxUploadOpt,
123+
noQrOpt,
118124
verboseOpt
119125
};
120126

@@ -134,6 +140,7 @@ public static RootCommand Build(Func<ServeSettings, CancellationToken, Task<int>
134140
UseHttps = parseResult.GetValue(httpsOpt),
135141
ServeHidden = parseResult.GetValue(hiddenOpt),
136142
MaxUploadBytes = parseResult.GetRequiredValue(maxUploadOpt),
143+
ShowQr = !parseResult.GetValue(noQrOpt),
137144
Verbose = parseResult.GetValue(verboseOpt)
138145
};
139146
return run(settings, ct);

0 commit comments

Comments
 (0)