mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-11 13:29:12 +00:00
75 lines
3.2 KiB
Go
75 lines
3.2 KiB
Go
|
// Code generated by templ - DO NOT EDIT.
|
||
|
|
||
|
// templ: version: v0.2.771
|
||
|
package files
|
||
|
|
||
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||
|
|
||
|
import "github.com/a-h/templ"
|
||
|
import templruntime "github.com/a-h/templ/runtime"
|
||
|
|
||
|
func VaultServiceWorker(path string) templ.Component {
|
||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||
|
if !templ_7745c5c3_IsBuffer {
|
||
|
defer func() {
|
||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err == nil {
|
||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||
|
}
|
||
|
}()
|
||
|
}
|
||
|
ctx = templ.InitializeContext(ctx)
|
||
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||
|
if templ_7745c5c3_Var1 == nil {
|
||
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||
|
}
|
||
|
ctx = templ.ClearChildren(ctx)
|
||
|
templ_7745c5c3_Err = serviceWorkerJS(path).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
return templ_7745c5c3_Err
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func serviceWorkerJS(path string) templ.ComponentScript {
|
||
|
return templ.ComponentScript{
|
||
|
Name: `__templ_serviceWorkerJS_2501`,
|
||
|
Function: `function __templ_serviceWorkerJS_2501(path){importScripts('https://cdn.jsdelivr.net/gh/golang/go@go1.18.4/misc/wasm/wasm_exec.js')
|
||
|
importScripts('https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@v1.1.0/sw.js')
|
||
|
}`,
|
||
|
Call: templ.SafeScript(`__templ_serviceWorkerJS_2501`, path),
|
||
|
CallInline: templ.SafeScriptInline(`__templ_serviceWorkerJS_2501`, path),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func IndexHTML() templ.Component {
|
||
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||
|
if !templ_7745c5c3_IsBuffer {
|
||
|
defer func() {
|
||
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||
|
if templ_7745c5c3_Err == nil {
|
||
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||
|
}
|
||
|
}()
|
||
|
}
|
||
|
ctx = templ.InitializeContext(ctx)
|
||
|
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
|
||
|
if templ_7745c5c3_Var2 == nil {
|
||
|
templ_7745c5c3_Var2 = templ.NopComponent
|
||
|
}
|
||
|
ctx = templ.ClearChildren(ctx)
|
||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<html><head><title>Sonr ID</title><script>\n navigator.serviceWorker.register('sw.js')\n registerWasmHTTPListener(path)\n\n // Skip installed stage and jump to activating stage\n addEventListener('install', (event) => {\n event.waitUntil(skipWaiting())\n })\n\n // Start controlling clients as soon as the SW is activated\n addEventListener('activate', event => {\n event.waitUntil(clients.claim())\n })\n </script></head></html>")
|
||
|
if templ_7745c5c3_Err != nil {
|
||
|
return templ_7745c5c3_Err
|
||
|
}
|
||
|
return templ_7745c5c3_Err
|
||
|
})
|
||
|
}
|
||
|
|
||
|
var _ = templruntime.GeneratedTemplate
|