mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
cmd/tailscale: add licenses link to web UI
The `tailscale web` UI is the primary interface for Synology and Home Assistant users (and perhaps others), so is the logical place to put our open source license notices. I don't love adding things to what is currently a very minimal UI, but I'm not sure of a better option. Updates tailscale/corp#5780 Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
parent
024257ef5a
commit
f03a63910d
@ -19,24 +19,27 @@
|
|||||||
Exec: runLicenses,
|
Exec: runLicenses,
|
||||||
}
|
}
|
||||||
|
|
||||||
func runLicenses(ctx context.Context, args []string) error {
|
// licensesURL returns the absolute URL containing open source license information for the current platform.
|
||||||
var licenseURL string
|
func licensesURL() string {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android":
|
case "android":
|
||||||
licenseURL = "https://tailscale.com/licenses/android"
|
return "https://tailscale.com/licenses/android"
|
||||||
case "darwin", "ios":
|
case "darwin", "ios":
|
||||||
licenseURL = "https://tailscale.com/licenses/apple"
|
return "https://tailscale.com/licenses/apple"
|
||||||
case "windows":
|
case "windows":
|
||||||
licenseURL = "https://tailscale.com/licenses/windows"
|
return "https://tailscale.com/licenses/windows"
|
||||||
default:
|
default:
|
||||||
licenseURL = "https://tailscale.com/licenses/tailscale"
|
return "https://tailscale.com/licenses/tailscale"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func runLicenses(ctx context.Context, args []string) error {
|
||||||
|
licenses := licensesURL()
|
||||||
outln(`
|
outln(`
|
||||||
Tailscale wouldn't be possible without the contributions of thousands of open
|
Tailscale wouldn't be possible without the contributions of thousands of open
|
||||||
source developers. To see the open source packages included in Tailscale and
|
source developers. To see the open source packages included in Tailscale and
|
||||||
their respective license information, visit:
|
their respective license information, visit:
|
||||||
|
|
||||||
` + licenseURL)
|
` + licenses)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ type tmplData struct {
|
|||||||
IP string
|
IP string
|
||||||
AdvertiseExitNode bool
|
AdvertiseExitNode bool
|
||||||
AdvertiseRoutes string
|
AdvertiseRoutes string
|
||||||
|
LicensesURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
var webCmd = &ffcli.Command{
|
var webCmd = &ffcli.Command{
|
||||||
@ -392,6 +393,7 @@ func webHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Profile: profile,
|
Profile: profile,
|
||||||
Status: st.BackendState,
|
Status: st.BackendState,
|
||||||
DeviceName: deviceName,
|
DeviceName: deviceName,
|
||||||
|
LicensesURL: licensesURL(),
|
||||||
}
|
}
|
||||||
exitNodeRouteV4 := netip.MustParsePrefix("0.0.0.0/0")
|
exitNodeRouteV4 := netip.MustParsePrefix("0.0.0.0/0")
|
||||||
exitNodeRouteV6 := netip.MustParsePrefix("::/0")
|
exitNodeRouteV6 := netip.MustParsePrefix("::/0")
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="py-14">
|
<body class="py-14">
|
||||||
<main class="container max-w-lg mx-auto py-6 px-8 bg-white rounded-md shadow-2xl" style="width: 95%">
|
<main class="container max-w-lg mx-auto mb-8 py-6 px-8 bg-white rounded-md shadow-2xl" style="width: 95%">
|
||||||
<header class="flex justify-between items-center min-width-0 py-2 mb-8">
|
<header class="flex justify-between items-center min-width-0 py-2 mb-8">
|
||||||
<svg width="26" height="26" viewBox="0 0 23 23" title="Tailscale" fill="none" xmlns="http://www.w3.org/2000/svg"
|
<svg width="26" height="26" viewBox="0 0 23 23" title="Tailscale" fill="none" xmlns="http://www.w3.org/2000/svg"
|
||||||
class="flex-shrink-0 mr-4">
|
class="flex-shrink-0 mr-4">
|
||||||
@ -100,6 +100,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</main>
|
</main>
|
||||||
|
<footer class="container max-w-lg mx-auto text-center">
|
||||||
|
<a class="text-xs text-gray-500 hover:text-gray-600" href="{{ .LicensesURL }}">Open Source Licenses</a>
|
||||||
|
</footer>
|
||||||
<script>(function () {
|
<script>(function () {
|
||||||
const advertiseExitNode = {{.AdvertiseExitNode}};
|
const advertiseExitNode = {{.AdvertiseExitNode}};
|
||||||
let fetchingUrl = false;
|
let fetchingUrl = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user