1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-10-17 20:05:55 +02:00

Fix apple profile issue being generated with escaped characters

This commit is contained in:
Kristoffer Dalby 2022-03-01 07:30:35 +00:00
parent b1bd17f316
commit 5157f356cb

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"html/template" "html/template"
"net/http" "net/http"
textTemplate "text/template"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gofrs/uuid" "github.com/gofrs/uuid"
@ -30,7 +31,7 @@ func (h *Headscale) AppleMobileConfig(ctx *gin.Context) {
<p><code>curl {{.Url}}/apple/ios</code></p> <p><code>curl {{.Url}}/apple/ios</code></p>
--> -->
<p><code>curl {{.Url}}/apple/macos</code></p> <p><code>curl {{.Url}}/apple/macos</code></p>
<h2>Profiles</h2> <h2>Profiles</h2>
<!-- <!--
@ -39,7 +40,7 @@ func (h *Headscale) AppleMobileConfig(ctx *gin.Context) {
<a href="/apple/ios" download="headscale_ios.mobileconfig">iOS profile</a> <a href="/apple/ios" download="headscale_ios.mobileconfig">iOS profile</a>
</p> </p>
--> -->
<h3>macOS</h3> <h3>macOS</h3>
<p>Headscale can be set to the default server by installing a Headscale configuration profile:</p> <p>Headscale can be set to the default server by installing a Headscale configuration profile:</p>
<p> <p>
@ -58,7 +59,7 @@ func (h *Headscale) AppleMobileConfig(ctx *gin.Context) {
<code>defaults write io.tailscale.ipn.macos ControlURL {{.URL}}</code> <code>defaults write io.tailscale.ipn.macos ControlURL {{.URL}}</code>
<p>Restart Tailscale.app and log in.</p> <p>Restart Tailscale.app and log in.</p>
</body> </body>
</html>`)) </html>`))
@ -202,8 +203,8 @@ type AppleMobilePlatformConfig struct {
URL string URL string
} }
var commonTemplate = template.Must( var commonTemplate = textTemplate.Must(
template.New("mobileconfig").Parse(`<?xml version="1.0" encoding="UTF-8"?> textTemplate.New("mobileconfig").Parse(`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
@ -229,7 +230,7 @@ var commonTemplate = template.Must(
</plist>`), </plist>`),
) )
var iosTemplate = template.Must(template.New("iosTemplate").Parse(` var iosTemplate = textTemplate.Must(textTemplate.New("iosTemplate").Parse(`
<dict> <dict>
<key>PayloadType</key> <key>PayloadType</key>
<string>io.tailscale.ipn.ios</string> <string>io.tailscale.ipn.ios</string>