diff --git a/resources/templates/cards/api.html b/resources/templates/cards/api.html new file mode 100644 index 0000000..7c85a25 --- /dev/null +++ b/resources/templates/cards/api.html @@ -0,0 +1,35 @@ +{{- $format := splitList "\n" (trim .Data.format) -}} +{{- $title := replace " " "" .Title -}} +
+Loading...
+ {{range $_, $accessStr := $format}} + {{- $id := printf `%s_%s` $title (b64enc $accessStr) -}} + + {{end}} +${data.ip}
+ Country: ${data.country} (${data.country_iso}) + Time zone: ${data.time_zone} + """} + [users.admin] passwordHash = "$2a$10$w00dzQ1PP6nwXLhuzV2pFOUU6m8bcZXtDX3UVxpOYq3fTSwVMqPge" showPublic = true @@ -42,4 +52,4 @@ allowProxy = ["https://www.metaweather.com/"] type = "collection" title = "Science" icon = "ic:outline-science" - data = {"Google Scholar" = {"url" = "https://robinhood.com/", "target" = "sameTab"}} \ No newline at end of file + data = {"Google Scholar" = {"url" = "https://scholar.google.com/", "target" = "sameTab"}} \ No newline at end of file diff --git a/template.go b/template.go index 91ae0fe..87f8cdb 100644 --- a/template.go +++ b/template.go @@ -28,11 +28,17 @@ func wrapProxy(url string) string { return fmt.Sprint("/proxy/", b64url) } +// Wrap string in template.JS to unescape JS code +func unescapeJS(s string) template.JS { + return template.JS(s) +} + // Function to get template function map func getFuncMap() template.FuncMap { // Return function map with template functions return template.FuncMap{ "dyn_template": dynamicTemplate, "proxy": wrapProxy, + "unescJS": unescapeJS, } }