diff --git a/.env b/.env new file mode 100644 index 0000000..8bfaa86 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +STATIC_HOSTER_HOME=/home/nikurasu/hoster +STATIC_HOSTER_HOST_DIR=/home/dave/hosted/ +STATIC_HOSTER_API_KEY=e621 +STATIC_HOSTER_PORT=4200 +STATIC_HOSTER_BASE_ROUTE=/site diff --git a/.gitignore b/.gitignore index 587eea4..4008d94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ static-hoster hostdir +.env diff --git a/src/helper/helper.go b/src/helper/helper.go new file mode 100644 index 0000000..119e1cf --- /dev/null +++ b/src/helper/helper.go @@ -0,0 +1,20 @@ +package helper + +import ( + "io" + "os" +) + +func IsEmpty(path string) (bool, error) { + f, err := os.Open(path) + if err != nil { + return false, err + } + defer f.Close() + + _, err = f.Readdirnames(1) + if err == io.EOF { + return true, err + } + return false, err +} diff --git a/src/static/Go-Logo_Aqua.svg b/src/static/Go-Logo_Aqua.svg new file mode 100644 index 0000000..6a814c7 --- /dev/null +++ b/src/static/Go-Logo_Aqua.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/static/OpenSans-ExtraBold.ttf b/src/static/OpenSans-ExtraBold.ttf new file mode 100644 index 0000000..08d7185 Binary files /dev/null and b/src/static/OpenSans-ExtraBold.ttf differ diff --git a/src/static/OpenSans-Regular.ttf b/src/static/OpenSans-Regular.ttf new file mode 100644 index 0000000..1dc226d Binary files /dev/null and b/src/static/OpenSans-Regular.ttf differ diff --git a/src/static/gopherPride.png b/src/static/gopherPride.png new file mode 100644 index 0000000..0d59448 Binary files /dev/null and b/src/static/gopherPride.png differ diff --git a/src/static/index.html b/src/static/index.html new file mode 100644 index 0000000..d11e566 --- /dev/null +++ b/src/static/index.html @@ -0,0 +1,29 @@ + + + + + + + + Static Hoster + + +
+
+
+

You are ready to

+ The Golang logo +
+
+

Now upload some files to

+
Site
+

with a HTTP push request.

+

Click on the link to copy.

+
+
+ A Golang gopher with a pride shirt +
+
+ + + \ No newline at end of file diff --git a/src/static/setURL.js b/src/static/setURL.js new file mode 100644 index 0000000..ab941d3 --- /dev/null +++ b/src/static/setURL.js @@ -0,0 +1,6 @@ +let url = document.getElementById('siteURL') +let postURL = `${location.protocol}//${location.host}/api/update` +url.innerText = postURL +url.addEventListener('click', function() { + navigator.clipboard.writeText(postURL) +}) \ No newline at end of file diff --git a/src/static/style.css b/src/static/style.css new file mode 100644 index 0000000..ae97e66 --- /dev/null +++ b/src/static/style.css @@ -0,0 +1,80 @@ +@font-face { + font-family: 'Open Sans'; + src: url(OpenSans-ExtraBold.ttf); + font-weight: 900; +} + +@font-face { + font-family: 'Open Sans'; + src: url(OpenSans-Regular.ttf); + font-weight: 400; +} + +* { + margin: 0; + padding: 0; +} + +html { + font-family: 'Open Sans', sans-serif; +} + +body { + height: 100vh; + width: 100vw; + display: grid; + grid-template-rows: 60vh 40vh; + grid-template-columns: 100vw; + grid-template-areas: + "top" + "bottom"; +} + +.topBox { + grid-area: top; + display: flex; + color: #FFFFFF; + flex-direction: column; + align-items: center; + justify-content: space-between; + background-color: #5abad3; +} + +.topText>.heading { + font-weight: 900; + display: flex; + justify-content: center; + align-items: center; +} + +.topText>.heading>img { + width: 6rem; +} + +.subtext { + display: flex; + flex-direction: column; + align-items: center; + cursor: pointer; +} + +#siteURL:hover { + text-decoration: underline; +} + +#siteURL { + background-color: #222222; + padding: .5rem; + margin: .5rem; + border-radius: 5px; + color: #a1a1a1; +} + +#gopherImg { + max-height: 60%; +} + +.bottomBox { + grid-area: bottom; + background-color: #08667e; +} \ No newline at end of file