diff --git a/.gitignore b/.gitignore
index f2ec00d..e7770f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,11 @@ dist/
# Test data and logs folders
.data/
.idea/dataSources.xml
+
+# CDN link
+cdn/
+cdn
+
+# Config Link
+cnf/
+cnf
diff --git a/Makefile b/Makefile
index 2074b0c..f9d1b66 100644
--- a/Makefile
+++ b/Makefile
@@ -34,4 +34,7 @@ clean:
deploy: build
sudo systemctl stop wappcityuni
sudo cp "${BIN}" /usr/local/bin
+ sudo cp *.go.html cnf
+ sudo cp *.css cdn
+ sudo cp *.js cdn
sudo systemctl start wappcityuni
diff --git a/base.css b/base.css
new file mode 100644
index 0000000..aafc438
--- /dev/null
+++ b/base.css
@@ -0,0 +1,112 @@
+*{
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+main{
+ padding-top: 90px;
+ padding-left: 6px;
+}
+.no-dec{
+ text-decoration: none;
+}
+.no-lst-style{
+ list-style: none;
+}
+.header{
+ box-shadow: 1px 1px 5px 0px;
+ position: fixed;
+ top: 0;
+ width: 100%;
+}
+.home-button{
+ display: inline-block;
+ font-size: 60px;
+ padding: 7px 10px 6px;
+}
+.nav{
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ max-height: 0;
+}
+.nav-menu{
+ display: none;
+}
+.menu a{
+ display: block;
+ padding: 32px 30px;
+}
+.hmb{
+ cursor: pointer;
+ float: right;
+ background-color: transparent;
+ padding: 40px 20px;
+}
+.hmb-line{
+ display: block;
+ height: 2px;
+ position: relative;
+ width: 24px;
+
+}
+.hmb-line::before, .hmb-line::after{
+ content: '';
+ display: block;
+ height: 100%;
+ position: absolute;
+ transition: all .1s ease-out;
+ width: 100%;
+}
+.hmb-line::before{
+ top: 5px;
+}
+.hmb-line::after{
+ top: -5px;
+}
+.nav-menu:checked ~ nav{
+ max-height: 100%;
+}
+.nav-menu:checked ~ .hmb .hmb-line{
+ background: transparent;
+}
+.nav-menu:checked ~ .hmb .hmb-line::before{
+ transform: rotate(-45deg);
+ top:0;
+}
+.nav-menu:checked ~ .hmb .hmb-line::after{
+ transform: rotate(45deg);
+ top:0;
+}
+.flex-main{
+ display: flex;
+ flex-direction: column;
+}
+.box-main{
+ display: table;
+ width: 100%;
+ margin: 1px;
+ align-self: center;
+}
+@media (min-width: 480px){
+ .nav{
+ max-height: none;
+ top: 0;
+ position: relative;
+ float: right;
+ width: fit-content;
+ }
+ .menu li{
+ float: left;
+ }
+ .menu a:hover{
+ background-color: transparent;
+
+ }
+ .hmb{
+ display: none;
+ }
+ .box-main{
+ margin: 5px 10px;
+ }
+}
\ No newline at end of file
diff --git a/dark.css b/dark.css
new file mode 100644
index 0000000..bd03de0
--- /dev/null
+++ b/dark.css
@@ -0,0 +1,29 @@
+body{
+ color: #f9f9f9;
+ background-color: #050506;
+ border-color: #696969;
+}
+.header, .nav{
+ background-color: #1d1d1e;
+}
+.home-button{
+ color: #e0e0e0;
+}
+.home-button:hover{
+ background-color: #606061;
+}
+.header{
+ box-shadow-color: #696969;
+}
+.menu a{
+ color: #e0e0e0;
+}
+.menu a:hover{
+ background-color: #606061;
+}
+.hmb:hover{
+ background-color: #606061;
+}
+.hmb-line, .hmb-line::before, .hmb-line::after{
+ background: #e0e0e0;
+}
\ No newline at end of file
diff --git a/goinfo.go.html b/goinfo.go.html
index 5b299fb..4ab075d 100644
--- a/goinfo.go.html
+++ b/goinfo.go.html
@@ -13,7 +13,6 @@
text-align: center;
background-color: mediumslateblue;
}
-
table, th, td {
margin: auto;
text-align: left;
@@ -21,20 +20,16 @@
border-collapse: collapse;
word-break: break-word;
}
-
table, td {
background-color: lightgray;
}
-
table {
width: 80%;
}
-
th {
background-color: lightsteelblue;
width: 25%;
}
-
td {
width: 75%;
}
diff --git a/index.go.html b/index.go.html
new file mode 100644
index 0000000..70e44d2
--- /dev/null
+++ b/index.go.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ City University Portfolio
+
+ {{ if .Light }}
+
+ {{ else }}
+
+ {{ end }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.go.yml b/index.go.yml
new file mode 100644
index 0000000..27b69ff
--- /dev/null
+++ b/index.go.yml
@@ -0,0 +1,11 @@
+cssBaseURL: "http://192.168.1.193:8081/test/base.css"
+cssDarkURL: "http://192.168.1.193:8081/test/dark.css"
+cssLightURL: "http://192.168.1.193:8081/test/light.css"
+jScriptURL: "http://192.168.1.193:8081/test/index.js"
+headerLinks:
+ Main Portfolio: "https://portfolio.captainalm.com/"
+ Root Site Home: "https://www.captainalm.com/"
+ Github: "https://github.com/Captain-ALM/"
+about:
+ title: "Alfred Manville (Captain ALM)"
+entries:
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..e69de29
diff --git a/pageHandler/pages/index/data.go b/pageHandler/pages/index/data.go
index 81afea0..bac0b4c 100644
--- a/pageHandler/pages/index/data.go
+++ b/pageHandler/pages/index/data.go
@@ -1,12 +1,31 @@
package index
type DataYaml struct {
- HomeLink string `yaml:"homeLink"`
- PortfolioLink string `yaml:"portfolioLink"`
- CSSBaseURL string `yaml:"cssBaseURL"`
- CSSLightURL string `yaml:"cssLightURL"`
- CSSDarkURL string `yaml:"cssDarkURL"`
- JScriptURL string `yaml:"jScriptURL"`
- About AboutYaml `yaml:"about"`
- Entries []EntryYaml `yaml:"entries"`
+ HeaderLinks map[string]string `yaml:"headerLinks"`
+ CSSBaseURL string `yaml:"cssBaseURL"`
+ CSSLightURL string `yaml:"cssLightURL"`
+ CSSDarkURL string `yaml:"cssDarkURL"`
+ JScriptURL string `yaml:"jScriptURL"`
+ About AboutYaml `yaml:"about"`
+ Entries []EntryYaml `yaml:"entries"`
+}
+
+func (dy DataYaml) GetHeaderLabels() []string {
+ if dy.HeaderLinks == nil {
+ return []string{}
+ }
+ toReturn := make([]string, len(dy.HeaderLinks))
+ i := 0
+ for key := range dy.HeaderLinks {
+ toReturn[i] = key
+ i++
+ }
+ return toReturn
+}
+
+func (dy DataYaml) GetHeaderLink(headerLabel string) string {
+ if dy.HeaderLinks == nil {
+ return ""
+ }
+ return dy.HeaderLinks[headerLabel]
}
diff --git a/pageHandler/pages/index/entry.go b/pageHandler/pages/index/entry.go
index 06c85bd..749707c 100644
--- a/pageHandler/pages/index/entry.go
+++ b/pageHandler/pages/index/entry.go
@@ -1,6 +1,7 @@
package index
import (
+ "golang.captainalm.com/cityuni-webserver/utils/yaml"
"html/template"
"time"
)
@@ -8,14 +9,14 @@ import (
const dateFormat = "2006-01-02"
type EntryYaml struct {
- Name string `yaml:"name"`
- Content string `yaml:"content"`
- StartDate time.Time `yaml:"startDate"`
- EndDate time.Time `yaml:"endDate"`
- VideoLocation string `yaml:"videoLocation"`
- VideoContentType string `yaml:"videoContentType"`
- ThumbnailLocations []string `yaml:"thumbnailLocations"`
- ImageLocations []string `yaml:"imageLocations"`
+ Name string `yaml:"name"`
+ Content string `yaml:"content"`
+ StartDate yaml.DateType `yaml:"startDate"`
+ EndDate yaml.DateType `yaml:"endDate"`
+ VideoLocation string `yaml:"videoLocation"`
+ VideoContentType string `yaml:"videoContentType"`
+ ThumbnailLocations []string `yaml:"thumbnailLocations"`
+ ImageLocations []string `yaml:"imageLocations"`
}
func (ey EntryYaml) GetStartDate() string {
@@ -34,7 +35,7 @@ func (ey EntryYaml) GetEndTime() time.Time {
if ey.EndDate.IsZero() {
return time.Now()
} else {
- return ey.EndDate
+ return ey.EndDate.Time
}
}
@@ -43,5 +44,5 @@ func (ey EntryYaml) GetContent() template.HTML {
}
func (ey EntryYaml) GetDuration() time.Duration {
- return ey.GetEndTime().Sub(ey.StartDate).Truncate(time.Second)
+ return ey.GetEndTime().Sub(ey.StartDate.Time).Truncate(time.Second)
}
diff --git a/pageHandler/pages/index/index-page.go b/pageHandler/pages/index/index-page.go
index bb73fe4..213a12a 100644
--- a/pageHandler/pages/index/index-page.go
+++ b/pageHandler/pages/index/index-page.go
@@ -17,12 +17,14 @@ const yamlName = "index.go.yml"
func NewPage(dataStore string, cacheTemplates bool) *Page {
var ptm *sync.Mutex
+ var sdm *sync.Mutex
if cacheTemplates {
ptm = &sync.Mutex{}
+ sdm = &sync.Mutex{}
}
pageToReturn := &Page{
DataStore: dataStore,
- StoredDataMutex: &sync.Mutex{},
+ StoredDataMutex: sdm,
PageTemplateMutex: ptm,
}
return pageToReturn
diff --git a/pageHandler/pages/index/template-marshal.go b/pageHandler/pages/index/template-marshal.go
index afc91a0..82fd730 100644
--- a/pageHandler/pages/index/template-marshal.go
+++ b/pageHandler/pages/index/template-marshal.go
@@ -15,12 +15,12 @@ func (m Marshal) GetEntries() (toReturn []EntryYaml) {
toReturn = m.Data.Entries
if m.OrderStartDate > 0 {
sort.Slice(toReturn, func(i, j int) bool {
- return toReturn[i].StartDate.Before(toReturn[j].StartDate)
+ return toReturn[i].StartDate.Before(toReturn[j].StartDate.Time)
})
}
if m.OrderStartDate < 0 {
sort.Slice(toReturn, func(i, j int) bool {
- return toReturn[i].StartDate.After(toReturn[j].StartDate)
+ return toReturn[i].StartDate.After(toReturn[j].StartDate.Time)
})
}
if m.OrderEndDate > 0 {
diff --git a/utils/yaml/date-type.go b/utils/yaml/date-type.go
new file mode 100644
index 0000000..910cd12
--- /dev/null
+++ b/utils/yaml/date-type.go
@@ -0,0 +1,31 @@
+package yaml
+
+import (
+ "gopkg.in/yaml.v3"
+ "strings"
+ "time"
+)
+
+const dateFormat = "02/01/2006"
+
+type DateType struct {
+ time.Time
+}
+
+func (dt *DateType) MarshalYAML() (interface{}, error) {
+ return dt.Time.Format(dateFormat), nil
+}
+
+func (dt *DateType) UnmarshalYAML(value *yaml.Node) error {
+ var stringIn string
+ err := value.Decode(&stringIn)
+ if err != nil {
+ return nil
+ }
+ pt, err := time.Parse(dateFormat, strings.TrimSpace(stringIn))
+ if err != nil {
+ return err
+ }
+ dt.Time = pt
+ return nil
+}