Commit 702f674e authored by Janne Koschinski's avatar Janne Koschinski

Cleanup

parent 65460f3a
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata>
<defs>
<font id="fontello" horiz-adv-x="1000" >
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="download" unicode="&#xe800;" d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z" horiz-adv-x="928.6" />
<metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata>
<defs>
<font id="fontello" horiz-adv-x="1000">
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850"
descent="-150"/>
<missing-glyph horiz-adv-x="1000"/>
<glyph glyph-name="download" unicode="&#xe800;"
d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z"
horiz-adv-x="928.6"/>
<glyph glyph-name="github" unicode="&#xf09b;" d="M429 779q116 0 215-58t156-156 57-215q0-140-82-252t-211-155q-15-3-22 4t-7 17q0 1 0 43t0 75q0 54-29 79 32 3 57 10t53 22 45 37 30 58 11 84q0 67-44 115 21 51-4 114-16 5-46-6t-51-25l-21-13q-52 15-107 15t-108-15q-8 6-23 15t-47 22-47 7q-25-63-5-114-44-48-44-115 0-47 12-83t29-59 45-37 52-22 57-10q-21-20-27-58-12-5-25-8t-32-3-36 12-31 35q-11 18-27 29t-28 14l-11 1q-12 0-16-2t-3-7 5-8 7-6l4-3q12-6 24-21t18-29l6-13q7-21 24-34t37-17 39-3 31 1l13 3q0-22 0-50t1-30q0-10-8-17t-22-4q-129 43-211 155t-82 252q0 117 58 215t155 156 216 58z m-267-616q2 4-3 7-6 1-8-1-1-4 4-7 5-3 7 1z m18-19q4 3-1 9-6 5-9 2-4-3 1-9 5-6 9-2z m16-25q6 4 0 11-4 7-9 3-5-3 0-10t9-4z m24-23q4 4-2 10-7 7-11 2-5-5 2-11 6-6 11-1z m32-14q1 6-8 9-8 2-10-4t7-9q8-3 11 4z m35-3q0 7-10 6-9 0-9-6 0-7 10-6 9 0 9 6z m32 5q-1 7-10 5-9-1-8-8t10-4 8 7z" horiz-adv-x="857.1" />
</font>
</defs>
<glyph glyph-name="github" unicode="&#xf09b;"
d="M429 779q116 0 215-58t156-156 57-215q0-140-82-252t-211-155q-15-3-22 4t-7 17q0 1 0 43t0 75q0 54-29 79 32 3 57 10t53 22 45 37 30 58 11 84q0 67-44 115 21 51-4 114-16 5-46-6t-51-25l-21-13q-52 15-107 15t-108-15q-8 6-23 15t-47 22-47 7q-25-63-5-114-44-48-44-115 0-47 12-83t29-59 45-37 52-22 57-10q-21-20-27-58-12-5-25-8t-32-3-36 12-31 35q-11 18-27 29t-28 14l-11 1q-12 0-16-2t-3-7 5-8 7-6l4-3q12-6 24-21t18-29l6-13q7-21 24-34t37-17 39-3 31 1l13 3q0-22 0-50t1-30q0-10-8-17t-22-4q-129 43-211 155t-82 252q0 117 58 215t155 156 216 58z m-267-616q2 4-3 7-6 1-8-1-1-4 4-7 5-3 7 1z m18-19q4 3-1 9-6 5-9 2-4-3 1-9 5-6 9-2z m16-25q6 4 0 11-4 7-9 3-5-3 0-10t9-4z m24-23q4 4-2 10-7 7-11 2-5-5 2-11 6-6 11-1z m32-14q1 6-8 9-8 2-10-4t7-9q8-3 11 4z m35-3q0 7-10 6-9 0-9-6 0-7 10-6 9 0 9 6z m32 5q-1 7-10 5-9-1-8-8t10-4 8 7z"
horiz-adv-x="857.1"/>
</font>
</defs>
</svg>
\ No newline at end of file
......@@ -4,6 +4,7 @@
*:focus
outline: none
*::-moz-focus-inner
border: 0
......@@ -22,7 +23,7 @@ nav
position: sticky
top: 0
background: #333333
box-shadow: 0 2px 4px rgba(0,0,0,0.2)
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2)
padding: 0 16px
ul
display: flex
......@@ -71,7 +72,7 @@ nav
.alert
padding: 16px
margin: 16px 0
box-shadow: 0 2px 4px rgba(33,33,33,0.2)
box-shadow: 0 2px 4px rgba(33, 33, 33, 0.2)
text-decoration: none
border-radius: 2px
&.success
......@@ -89,7 +90,7 @@ nav
form.upload
padding: 96px 0
box-shadow: 0 2px 4px rgba(0,0,0,0.2)
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2)
text-decoration: none
border-radius: 2px
text-align: center
......@@ -136,13 +137,13 @@ form.upload
text-overflow: ellipsis
overflow: hidden
.detail
.detail
max-width: 640px
margin: 32px auto
width: 100%
background: #333333
border-radius: 4px
box-shadow: 0 2px 4px rgba(0,0,0,0.4)
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4)
.title
line-height: 1.25
padding: 16px
......@@ -152,7 +153,7 @@ form.upload
color: #eee
&:empty
display: none
&+.image
& + .image
border-top-left-radius: 4px
border-top-right-radius: 4px
.image
......
......@@ -3,13 +3,12 @@ package main
import (
"net/http"
"fmt"
"time"
"path"
)
type AlbumDetailData struct {
User UserInfo
Album Album
Album Album
IsMine bool
}
......
......@@ -4,11 +4,13 @@
{{range .Images}}
<a class="image" href="/i/{{.Id}}">
<div class="image-container">
<img src="/{{.Id}}t" >
<img src="/{{.Id}}t">
</div>
<div class="info">
<p>{{.OriginalName}}</p>
<p><time>{{.CreatedAt.Format "2006-01-02 15:04"}}</time></p>
<p>
<time>{{.CreatedAt.Format "2006-01-02 15:04"}}</time>
</p>
<p>{{.MimeType}}</p>
</div>
</a>
......
......@@ -8,11 +8,11 @@
</div>
{{else}}
<div class="alert error">
{{if .Id}}
{{if .Id}}
<h2>Upload of {{.Id}} failed.</h2>
{{else}}
{{else}}
<h2>Upload failed.</h2>
{{end}}
{{end}}
{{range .Errors}}
<pre>{{.}}</pre>
{{end}}
......@@ -20,7 +20,8 @@
{{end}}
{{end}}
<form class="upload" action="/upload/" method="POST" enctype="multipart/form-data">
<input type="file" name="file" accept=".jpg,.jpeg,.png,.gif,.apng,.tiff,.tif,.bmp,.webp,.mp4,.mov" multiple/><br>
<input type="file" name="file" accept=".jpg,.jpeg,.png,.gif,.apng,.tiff,.tif,.bmp,.webp,.mp4,.mov"
multiple/><br>
<input type="submit"/>
</form>
</div>
......
......@@ -16,7 +16,7 @@ type Image struct {
}
type Result struct {
Id string `json:"id"`
Id string `json:"id"`
Success bool `json:"success"`
Errors []string `json:"errors"`
}
......
......@@ -7,12 +7,6 @@ import (
"time"
"database/sql"
"github.com/go-redis/redis"
"encoding/base64"
"io"
"mime/multipart"
"path/filepath"
"os"
"crypto/rand"
)
type UserInfo struct {
......@@ -30,18 +24,18 @@ type PageContext struct {
}
type AlbumImage struct {
Id string
Title string
Id string
Title string
Description string
Position int
Position int
}
type Album struct {
Id string
Title string
Id string
Title string
Description string
CreatedAt time.Time
Images []AlbumImage
CreatedAt time.Time
Images []AlbumImage
}
func parseUser(r *http.Request) UserInfo {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment