-
Notifications
You must be signed in to change notification settings - Fork 5
/
service-make-splash-screen.go
97 lines (81 loc) · 2.14 KB
/
service-make-splash-screen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* For license and copyright information please see LEGAL file in repository */
package www
import (
"bytes"
"text/template"
"../protocol"
)
// MakeSplashFiles make splash screen that use as landing page or first screen user see when open GUI app.
func MakeSplashFiles(html, css, json protocol.File) (err error) {
html.Rename("splash.html")
var htmlBuf = new(bytes.Buffer)
if err = splashHTMLFileTemplate.Execute(htmlBuf, ""); err != nil {
return
}
html.Data().Unmarshal(htmlBuf.Bytes())
css.Rename("splash.css")
var cssBuf = new(bytes.Buffer)
if err = splashCSSFileTemplate.Execute(cssBuf, ""); err != nil {
return
}
css.Data().Unmarshal(cssBuf.Bytes())
json.Rename("splash.json")
var jsonBuf = new(bytes.Buffer)
if err = splashJSONFileTemplate.Execute(jsonBuf, ""); err != nil {
return
}
json.Data().Unmarshal(jsonBuf.Bytes())
return
}
var splashHTMLFileTemplate = template.Must(template.New("splashHTMLFile").Parse(`
<!-- For license and copyright information please see LEGAL file in repository -->
<main>
<div>
<img src="/images/app-icon-128x128.png" alt="Platform logo" />
<p>
POWERED BY <br />
<a href="/cloud">SABZCITY PLATFORM</a>
</p>
<noscript>Please Enable Javascript to be able to use this web app.</noscript>
</div>
</main>
`))
var splashCSSFileTemplate = template.Must(template.New("splashCSSFile").Parse(`
/* For license and copyright information please see LEGAL file in repository */
main {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5)
}
div {
position: absolute;
height: 200px;
max-width: 400px;
top: 0;
bottom: 0;
right: 0;
left: 0;
margin: auto;
text-align: center;
background: #ffffff;
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
}
/* img {} */
p {
color: #92989b;
font-family: sans-serif;
font-size: 9pt
}
a {
color: #616161;
text-decoration: none
}
`))
var splashJSONFileTemplate = template.Must(template.New("splashJSONFile").Parse(`
{
"en": []
}
`))