Compare commits

..

1 Commits

Author SHA1 Message Date
a8711fc659 Update gitignore 2020-10-19 08:06:33 -05:00
38 changed files with 785 additions and 2349 deletions

8
.gitignore vendored
View File

@ -11,6 +11,8 @@ ribbit.db
# Example Feeds
rssfeed.xml
# vim-restconsole
console.rest
vrc_cookie_jar
# Netcaptain
.ncpt
# vim local config
.vimrc.local

566
assets.go
View File

@ -1,566 +0,0 @@
// Code generated by "esc -o assets.go assets templates"; DO NOT EDIT.
package main
import (
"bytes"
"compress/gzip"
"encoding/base64"
"io/ioutil"
"net/http"
"os"
"path"
"sync"
"time"
)
type _escLocalFS struct{}
var _escLocal _escLocalFS
type _escStaticFS struct{}
var _escStatic _escStaticFS
type _escDirectory struct {
fs http.FileSystem
name string
}
type _escFile struct {
compressed string
size int64
modtime int64
local string
isDir bool
once sync.Once
data []byte
name string
}
func (_escLocalFS) Open(name string) (http.File, error) {
f, present := _escData[path.Clean(name)]
if !present {
return nil, os.ErrNotExist
}
return os.Open(f.local)
}
func (_escStaticFS) prepare(name string) (*_escFile, error) {
f, present := _escData[path.Clean(name)]
if !present {
return nil, os.ErrNotExist
}
var err error
f.once.Do(func() {
f.name = path.Base(name)
if f.size == 0 {
return
}
var gr *gzip.Reader
b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed))
gr, err = gzip.NewReader(b64)
if err != nil {
return
}
f.data, err = ioutil.ReadAll(gr)
})
if err != nil {
return nil, err
}
return f, nil
}
func (fs _escStaticFS) Open(name string) (http.File, error) {
f, err := fs.prepare(name)
if err != nil {
return nil, err
}
return f.File()
}
func (dir _escDirectory) Open(name string) (http.File, error) {
return dir.fs.Open(dir.name + name)
}
func (f *_escFile) File() (http.File, error) {
type httpFile struct {
*bytes.Reader
*_escFile
}
return &httpFile{
Reader: bytes.NewReader(f.data),
_escFile: f,
}, nil
}
func (f *_escFile) Close() error {
return nil
}
func (f *_escFile) Readdir(count int) ([]os.FileInfo, error) {
return nil, nil
}
func (f *_escFile) Stat() (os.FileInfo, error) {
return f, nil
}
func (f *_escFile) Name() string {
return f.name
}
func (f *_escFile) Size() int64 {
return f.size
}
func (f *_escFile) Mode() os.FileMode {
return 0
}
func (f *_escFile) ModTime() time.Time {
return time.Unix(f.modtime, 0)
}
func (f *_escFile) IsDir() bool {
return f.isDir
}
func (f *_escFile) Sys() interface{} {
return f
}
// FS returns a http.Filesystem for the embedded assets. If useLocal is true,
// the filesystem's contents are instead used.
func FS(useLocal bool) http.FileSystem {
if useLocal {
return _escLocal
}
return _escStatic
}
// Dir returns a http.Filesystem for the embedded assets on a given prefix dir.
// If useLocal is true, the filesystem's contents are instead used.
func Dir(useLocal bool, name string) http.FileSystem {
if useLocal {
return _escDirectory{fs: _escLocal, name: name}
}
return _escDirectory{fs: _escStatic, name: name}
}
// FSByte returns the named file from the embedded assets. If useLocal is
// true, the filesystem's contents are instead used.
func FSByte(useLocal bool, name string) ([]byte, error) {
if useLocal {
f, err := _escLocal.Open(name)
if err != nil {
return nil, err
}
b, err := ioutil.ReadAll(f)
_ = f.Close()
return b, err
}
f, err := _escStatic.prepare(name)
if err != nil {
return nil, err
}
return f.data, nil
}
// FSMustByte is the same as FSByte, but panics if name is not present.
func FSMustByte(useLocal bool, name string) []byte {
b, err := FSByte(useLocal, name)
if err != nil {
panic(err)
}
return b
}
// FSString is the string version of FSByte.
func FSString(useLocal bool, name string) (string, error) {
b, err := FSByte(useLocal, name)
return string(b), err
}
// FSMustString is the string version of FSMustByte.
func FSMustString(useLocal bool, name string) string {
return string(FSMustByte(useLocal, name))
}
var _escData = map[string]*_escFile{
"/assets/css/main.css": {
local: "assets/css/main.css",
size: 4980,
modtime: 1547133837,
compressed: `
H4sIAAAAAAAC/7RXW2vcOBR+n18hCIWkVK4nzTSJA2GhF/Zh96mPpQ+yJdsismRkeTJpyX9fdLMlW54u
CwsJjHUuOpfvXNSqjoFfOwA6ymFLaNOqAuzz/M3D7nW3KwV+MdRKMCELcHF7e/uwxYwMpyInBTGphESK
Cl4ALjgx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voJKcfkZNjydA+UTYku83fA/WWHq4Qbj5geFz3jjf4P
DLvzPdsz5P3JFWoyzAb4yeXLmxoj0g/n1Sq/UemYHi9IV9KmIZzgb5UkhH9rXUH7ja0X1Idqy8Qzqh5p
1/yK5lQ4uVyGpsmlp2Y9MjYY+eUUfJPI8e83nBgtSQiEPXPKh8fFPs/3QYXUQnbAbM/ffZX8KLhQl9/V
S09+XGX+VNcSNLD27WMzwf7zcDjom+ymbuaUDDemm9xPoT86gikCl/qJNhFJd2W456V6vWut4xmGsKYn
Yp4Qr7tJz2rNTKxdK/Zp7VgIUE4VRewhss0ZYpSslsWUCwmDF2nWlWF7jjuwyoP36KJLTtoNo4EhQ0Pr
WMP36c1ZK0LgpT2cdAdv0t/MwWgSOsgsdA1jVZFh2NZ2fX2P6vttba+73fu34Fun1w5bvQN4+94DzdUj
4hhczpX84aAfNldutTza+tCpl4JBfX8PGCoJy/yZ+XI2rtcnbQYAmeDsBc5LWhJunm3o/JoUsGFSo5HN
ChVBHewQRw3pCFcOy8PajsiMDanHcE7GSLKrj33lTQFVSCq9RiFlg/sOzK+CrQDPRf0/RjgZujnCIR7+
nC1WAvxNMB27f2/7AjTg5s54BOwNTttvIBe0ubuEzo83ocq/bONcqwz1BCL/BAAA///ACu/RdBMAAA==
`,
},
"/assets/img/favicon.png": {
local: "assets/img/favicon.png",
size: 4752,
modtime: 1547232209,
compressed: `
H4sIAAAAAAAC/wCQEm/tiVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAIAAAC3LO29AAAAA3NCSVQICAjb
4U/gAAASSElEQVR4nO1beXRc1Xn/7tvnzapZNdoty7ItWchgI2xwvABGxHYJSWMSN5y2IW2TZmkoJ3HS
noQApT6QJiGnTU8TiiFO6bFpUAgkgbCTeCHGlmXZEta+YO2jZfZ56739Y8TzaPRmJNkCkpz8zv1j5nvf
/e73e/e97353eYgQAn/UoD5oB95z/InhHz7+xPAPH3/8DJmlVugaHzw/0vX2SO/wzPhEbBoAOIb12z11
xav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YJ8rFyMckqmFTzphTGLRVHpi8bmtn/j09bcvuO232K8R3ug6de9z/yGp
CkKIFzg+7xObBQZDgaKLGmHeDYhRDgFASFjCw0wIkWVNkWRCwGmxP3DbFzdX1i+m4mIZAkBSSX39me+/
1X8eE0zRlCByFE29DzunhBCsYympYB0zNHN95foHbvuCyJmf8ZqPJTAEAFXXTvS2fLXpu7OVERJEnqLf
w4+nsI6lpJx2skB0HLj9y/Ulq3MdUjbF0himkZCTT7e88n+nXgjFZwAAURRNUyzHLCNVXdM1Vdd1TDAG
gFJ34Sc2fnj3uq25juflweUwTEPWlCdOPPPrtmMTsWlj145haYZlEIUu4+klhBBMNFXT1FlrLM2UFBTe
uLrhrhs+xi6l3zJx+QzTkDVlODzx2LGm33SdVvVLJ70QAoQoRFEUhRACmjH73kLTCQGMCdb1rAV+kbPs
qdt2x8bGgMOzmI+b8uBKGRqIpOLnhjpbhzrfHu3tCV0MJ6NLteC3u1f6SmuCVTXByg3lteLSv34zxbIx
zELf5FDnWH/XxGBv6OJUPJzKOIBrQGQFt81V5SurK65aU1iZ64DoFeK9YpgJQkhKNVn4WK5eyo/3g+EH
iz/+74D/H7pyLaLgRAMBAAAAAElFTkSuQmCCAQAA//8F82/kkBIAAA==
`,
},
"/assets/vendor/css/grids-responsive-min.css": {
local: "assets/vendor/css/grids-responsive-min.css",
size: 8032,
modtime: 1547133812,
compressed: `
H4sIAAAAAAAC/8SVT4/bRg/G7/4UziHA+wa1LM9oRrL3UjTNoUBQFMipR68trIXqjyHLSbaL/e6FIc1G
fEjOIqc9PhQ1Esnh81t/eLf469qXy69p4hOz+NidH/vq4TQsTbqxy7/3p657t/hcHcr2Uh6X1/ZY9svh
VC5/+/L7cgoni9MwnC+79fqhGk7X++TQNevH25vr87Uv1/d1d79u9peh7Nef//j46c8vn5LmuPiwXvza
lMdqv7wc+rJsl/v2uPxfU7Wrb9VxOO2sS1zZ/P8puR2yuq4uzWrzy1wwaahGmVFtqYSnjkpPZUFkimez
f2FfN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GUu/VPcLtI5t7/Xs7NvgklDNcqMakslPHVUeioLIlM8m/0L+7rBgMVA
hgGHAY+BHAMFBrYQMExbKkkbDBZqsC7DDsS6DNZlmQbpqCStx8Mymu1gDthCh+meSvItbHcOh+fsOXkd
Z/F23J62QeG2sEoRbvNtULnN9yjG7XEJBW5PY9S4zXdZ4fY0MY3b3CJi3OY3U+X2uFYCtyUniXE7+IrG
bcEDFW4H/9G4LdlRjNvj2grclmxM47bkcBFuB//TuC3Zoczt4JMat0ebEbgtOWSE25J/atyWoBLldrBe
jduvwJS5NHL7vwAAAP//TZMIY2AfAAA=
`,
},
"/assets/vendor/css/pure-min.css": {
local: "assets/vendor/css/pure-min.css",
size: 16449,
modtime: 1547133812,
compressed: `
H4sIAAAAAAAC/+w7a4/bunLf8yt0sgiQDSSvLD9Xwgl6H7ntLW4PCpx+KXK3AC2NbXYlUSDpXW98/N8L
PiSRFGV7T4uiHwojWYkzHA45D84MqYcvP3341wOF4CWeLCfJhz+R5o3i3Z4HSTydBf+O9oT89OFvOIea
QREc6gJowPcQ/PHXPwe6efJhz3nD0oeHHeb7w2aSk+rhTfR8aA4UHjYl2TxUiHGgD3/765++/fLrt0lV
fPjy8EGMXhNaoRL/gEnOWPDyH7NJHPwW/Mtf/60lH/wW7DCfYPLQoRpsfs7vg19wTkrEgn9EZYl2e6AB
qovgn0mN+B7VwS+ASj1a4Iw2m8STmW+4dho1SNIPdr8vDxMxs2hz4JzU6ZbkBxaiFOUcv0CI0j15AXoi
B17iGtL4rLA52pQQyv9PG0ILoFFOyhI1DNL2IdMA1qAc17s0Pu95VZ62pObRFlW4fEsZqlnEgOJtFlUs
4nDkEcM/IELFfx4YT6dx/CmLXmHzjLkfet6Q4u1UIbrDdRqfEeU4LyFEDBcQFsARLlm4xbscNRyTWjwe
KIRbQjjQcA+oEH92lByasEK4DiuoD2GNXkIGuezBDlWF6NupwKwp0Vu6KUn+fEaHApMwR/ULYmFDyY4C
Y+ELLoB0mLgWaxbJDtkLCN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/tzVIKo/9ZNfawbrxaeHaYDc
D3a6ypU8jBhcn7VG4K389eu+LcypTdLlri2IKI3u7hYa24L7FWLmflg4Vudr+fEUsFrefHe+5I0uzY5N
SSizT+ix+BkfrQ4CcffTUxmzO1zeorgSNyJF4axyxDjFDRQBp2nN92o+n5M6mt57Kd9tE/GzqKrZCxrF
afRAaahRRr8NKd6+cmqUvb66tHzrarpDZ1ompNOjXlOm7kW5K6ya5N7D7H8FAAD//+G2/iZBQAAA
`,
},
"/templates/footer.html": {
local: "templates/footer.html",
size: 228,
modtime: 1547128347,
compressed: `
H4sIAAAAAAAC/1zPwQqDMAzG8btPEXIX0XPsu9SlYCFbh0kLvv3Yplh76uH/ox+hgWNxHXEsEHnGZ2Iv
fSphE7+j6wDoBwAAaB0rY9EkoKNhHc88VVnzconpEPeVJfH+zddA07NZeikesXEP8aozbkGD9e8sUn11
XvV/PgEAAP///4iBjuQAAAA=
`,
},
"/templates/header.html": {
local: "templates/header.html",
size: 200,
modtime: 1547136888,
compressed: `
H4sIAAAAAAAC/0yNsQrDIBRFd7/ikj0JZLYuhW6d2h+w+lIFayGaLPL+PRgkZHzvcM6V1m8wQad06+ag
k4OhmGlBKcOj3vfKmDslcP6elJL+ErOQo/WbEteK+cdMMbdOr0NoLvyM4bV+3j4HArMArp4jbWnpfxTX
QwCkm1Qpp8IsRzdV1FaPKEVbW3sAAAD//7XiV5HIAAAA
`,
},
"/templates/htmlfooter.html": {
local: "templates/htmlfooter.html",
size: 115,
modtime: 1547128255,
compressed: `
H4sIAAAAAAAC/1JQUFCw0U/JLLPjAjGrqxWKEvPSUxVUMnUUVMoUrGwV9IKTizILSooVamvBSmyKwXyF
4qJkW6XqapCq2lolOxt9iDjcnNS8FIgWG/2k/JRKOy4b/YyS3Bw7LkAAAAD//zPK1EBzAAAA
`,
},
"/templates/htmlheader.html": {
local: "templates/htmlheader.html",
size: 801,
modtime: 1547128244,
compressed: `
H4sIAAAAAAAC/5yST2/UMBDF7/spplaPdQxCCKjivZRKcAGk9oKqHrz2ZD2LYwd7krKK8t1R9g+70J44
JeOZ95uXF9cXH7/e3H//dgue27Bc1PsHQO3RuPkFoG6RDVhvckHWoudGvhfnrWha1GIgfOpSZgE2RcbI
WjyRY68dDmRR7ooroEhMJshiTUD9unr1AsphsZk6phTPaH8NeuZO4s+eBi1ujPUo57mcwpngS5K71lEY
KP6AjEEL03UBJafeekl23uIzNlooUwpyUdSuVWOGuVV1cS2Atx1qQa1Zo5oPnhGLT5ltz/CfuD2PiQMu
x7G6I8bqfq6mCSTMJ/3qUNdqP7ZY1BdSPlADgeHzLXx4PLjahwclWy3mnK6Vsi5uSmVD6l0TTMbKplaZ
jfmlAq2Kmv/62+JpUG+qd6eq2hSxrNWet1zUFw8YHTWPUh4MjyNkE9cIl3QFlwNca6jueBuweEQuME3P
cvrTPYY0jrNymg6ZjiNgdEflSws+oXGY73amTivOP/qEPJn/l12r4w2vV8ltD9E5GoCcFsFsU89iufgd
AAD//1puW/YhAwAA
`,
},
"/templates/login.html": {
local: "templates/login.html",
size: 812,
modtime: 1547136935,
compressed: `
H4sIAAAAAAAC/6SSTW7jMAyF9zkFwb3hC9gGZjHLwQSTuYBs0bFQSRQoKU1uX8RW/LNogaIr88mPTx8F
NtrcYLAqxhYnZUcYyCeSSlmL3QmgGVncyxCyUDUfrFWlrLl60ghqSIZ9i3WOJLXlq/EIjtLEusXz38v/
Oe+ZaMjqSGmRAHuEOXdgn4RtdRXOAV82gMaqniyMLC2SU8Zi9/v5gV9aC8XY1LNh12B8yAmMfvnBK0er
SI9ALSa6J4Rg1UATW03S4iEVQeXEIw85rsS1Nrfu9BP+oGJ8Z9HYnUv1Ff3qLgNseplh04c5zusl3wKP
nzALOXI9CR6bJhreer7vmg7sW9fCvumFfeuHf+UX/KEN4PgsZYIi+pwS+xIUc+9MOsIVw66ughin5IHd
ZfY39XJelrPeb2dTP1e8O5VLPwIAAP//0xnP9ywDAAA=
`,
},
"/templates/rss_feed.xml": {
local: "templates/rss_feed.xml",
size: 700,
modtime: 1547486966,
compressed: `
H4sIAAAAAAAC/2xSTY+bMBC951dMEbdt7bTqaev1alvUU9VDlZyiHAyeEivGIH/QShb/fQUG8qGcsGfe
e543D/b6v9HQo3WqNS/ZZ7LNXvmGWecuxS9km/ENAKtOwhjU4xmAeeU18j+qLJWHn4iS0VRKba3MmZ+8
754ptROIlEFrtFUr8V9rz45UbUNRKk9jJDtsOi08FsILsndoyT4oOQyMTkJJU6KrrOq8ag0fX4S/rYXH
ZIfWiAZHgWvWPJswdRA1cjSfgmN0vS9t578HpWUhPPJ7/bUzDXcDnRfjNf+6ZXT8TpUYwQpTI+TqI+Q9
PL/AreToxcEwJP6Hw4/ibfd2yOAJ8p4Ul/HhCbLjkWcJpzw26YE1jRjznvyefV+lAcC6UM528p78Es7v
OzmbWFoLtA5KJpxrg61wGL6lmw71cr5VmBgLfQrsOre75Cb+6OpxOPTiK0ZAI9NiGF1/P0atc3zzHgAA
//+UZXAKvAIAAA==
`,
},
"/templates/user_dashboard.html": {
local: "templates/user_dashboard.html",
size: 97,
modtime: 1547486320,
compressed: `
H4sIAAAAAAAC/7JJVMgoSk2zVdIvLU4t0k9LTU0pVrJzTcksUQguTSpOLsosKMnMzyu20U+04+JCqC4q
LtavrtYLSc0tyEksSXVJLEnUCy3NTKmtVbILCg5WcEtNTQHrAQQAAP//EcPbEmEAAAA=
`,
},
"/templates/user_feeds.html": {
local: "templates/user_feeds.html",
size: 4065,
modtime: 1547235825,
compressed: `
H4sIAAAAAAAC/5xX3W7bNhS+11MQRC5kxJHbXdaWgTbdgALFBszpbgLPoMVjiyhNCiRlJwj87gNJyaQU
WfN2kcDS+c4Pv/PDowVlR8RojgnnGy1rVYDeFFIYwgQovFzMKDsuk8VOqgMS5AA53gHQja63ulCsMkwK
jREp7I8cz2oNalZXlBjoQaTQ9fbATI69eBWJ/yK8hnSClwlCCyaq2riYrLGNdacxMq8V5LhklILATSSx
/GhN5BijmTOyrY2RotHyjvFyRY6wmHnR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tc9d63OxZ9dNm/010Kv
+GvW1r7HVuvisa7ojQ4b5BV/8Zrad9poerJ9Pyp56vbgQAHZFPvUDteIl8cFEIF0xVkBV9Wm6KOvwHiq
RWC3UTpkWz9XP8e659iDWdVbO0JC+M2Zr67WSp42+N7iMwUVJwWkeI6neOPa5ByMv4/BL5HezcCtG51o
4NoNYy1EHTTs5TlvbxIlT+GqsKkNZ9BfXp/I3q4vl1n1/GE90IXtJRzTdZVV5+wqY9En7SRz37Qojw7r
UuK/debJVdLmyWLWftT+EwAA///sH8RP4Q8AAA==
`,
},
"/": {
isDir: true,
local: "",
},
"/assets": {
isDir: true,
local: "assets",
},
"/assets/css": {
isDir: true,
local: "assets/css",
},
"/assets/img": {
isDir: true,
local: "assets/img",
},
"/assets/vendor": {
isDir: true,
local: "assets/vendor",
},
"/assets/vendor/css": {
isDir: true,
local: "assets/vendor/css",
},
"/templates": {
isDir: true,
local: "templates",
},
}

View File

@ -1,355 +0,0 @@
html {
min-height: 100%;
}
body {
color: #777;
min-height: 100%;
}
a {
text-decoration: none;
}
div.content {
padding: 15px;
min-height: 100%;
color: black;
}
div.half {
width: 50%;
}
.header {
margin-left: 0;
}
.fa-2 {
font-size: 2em;
}
.primary {
color: #0078e7;
}
.primary-bg {
background-color: #0078e7;
}
.error {
color: #DD0000;
}
.error-bg {
background-color: #DD0000;
}
div.optionalfield {
margin: 2em;
}
input.file {
padding: .5em .6em;
display: inline-block;
border: 1px solid #ccc;
box-shadow: inset 0 1px 3px #ddd;
border-radius: 4px;
}
input.ranking-input {
width: 50px;
border-radius: 5px;
border: 1px solid #CCC;
text-align: center;
}
i.move-icon {
cursor: ns-resize;
}
#menu {
width: 100%;
height: 40px;
position: relative;
background: #191818;
webkit-overflow-scrolling: touch;
}
#menu .pure-menu-heading {
display: inline-block;
}
#menu .pure-menu-nonlink {
color: #777;
padding: .5em 1em;
display: block;
text-decoration: none;
white-space: nowrap;
}
#menu .menu-button {
display: inline;
position: absolute;
top: 0px;
right: 0px;
margin-top: 10px;
margin-right: 10px;
color: white;
text-decoration: none;
}
.menu-bottom {
width: 150px;
border-top: 1px solid white;
}
#menu .menu-container {
display: none;
position: absolute;
right: 0px;
top: 40px;
background-color: #191818;
}
#menu .menu-container>ul {
background-color: #191818;
}
div.horizontal-scroll {
overflow-x: scroll;
}
img.thumbnail {
height: 100px;
max-height: 100%;
max-width: 100%;
}
.thumbnail-container {
display: block;
height: 100%;
background-color: #EEE;
padding-top: 20px;
}
.padding {
padding: 5px;
}
.space {
margin: 5px;
}
.space-sides {
margin-left: 5px;
margin-right: 5px;
}
.space-vertical {
margin-top: 5px;
margin-bottom: 5px;
}
.large {
font-size: 18px;
}
.big-space {
margin: 10px;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
.center {
text-align: center;
}
.center-all {
text-align: center;
vertical-align: center;
margin: auto;
}
table.center tbody>td {
text-align: center;
}
table.padding td {
padding: 5px;
}
table tfoot {
border-top: 1px solid #CCC;
}
.pure-button-error {
background-color: #DD0000;
color: #FFF;
}
.pure-button-toggle-first {
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
.pure-button-toggle-middle {
border-radius: 0px;
margin-left: -5px;
border-left: 1px solid #CCC;
}
.pure-button-toggle-last {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
margin-left: -5px;
border-left: 1px solid #CCC;
}
.pure-button:disabled {
background-color: #CCC;
color: #999;
}
#modal-body {
margin-bottom: 15px;
}
#modal-overlay {
visibility: hidden;
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
text-align: center;
z-index: 1000;
background-color: rgba(0, 0, 0, 0.5);
}
#modal-overlay>div {
margin: 10% 10%;
width: 80%;
margin: 100px auto;
background-color: #FFF;
border: 1px solid #000;
border-radius: 10px;
padding: 15px;
text-align: center;
}
div#embiggenedScreenShot {
cursor: pointer;
background-color: #FFF;
}
div#embiggenedScreenShot>img{
max-width:100%;
max-height:100%;
}
div.fullscreen {
height: 100%;
width: 100%;
position: absolute;
top: 0px;
left: 0px;
text-align: center;
margin: auto auto;
z-index:1001;
}
.pure-form input[disabled]:not([type]).disabled-but-visible {
background-color: #FFF;
color: #555;
}
input.larger {
width: 400px;
}
@media (min-width: 40em) {
#menu {
width: 150px;
height: 100%;
position: fixed;
}
#menu .menu-button {
display: none;
}
#menu .menu-container{
display: initial;
width: 100%;
}
.menu-bottom {
width: 150px;
position: fixed;
left: 0px;
bottom: 0px;
}
.header {
margin-left: 150px;
}
div.flash {
font-size: 24px;
position: fixed;
top: 0px;
width: 100%;
}
div.flash.error {
background-color: #DD0000;
color: #FFFFFF;
}
div.flash.success {
background-color: #229af9;
color: #FFFFFF;
}
}
/* Small Screens */
@media screen and (max-width:35.5em) {
div.pure-control-group label.control-label {
text-align: left;
}
.only-large {
display: none;
}
.only-small {
display: default;
}
.team-management-buttons {
text-align:left;
}
.team-management-buttons>.pure-button {
margin-top: 1em;
}
}
/* Starting at Small, horizontal */
@media screen and (min-width: 35.5em) {
div.pure-control-group label.control-label {
text-align: left;
}
.only-small {
display: none;
}
}
/* Small Horizontal to Medium */
@media screen and (min-width: 35.5em) and (max-width: 48em) { }
/* Medium Screens */
@media screen and (min-width: 48em) and (max-width:64em) { }
/* Larger Screens */
@media (min-width: 64em) { }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +0,0 @@
#!/bin/bash
cd plugin_src
for i in `ls`; do
go build -buildmode=plugin $i
done
cd ..
mv plugin_src/*.so plugins/

91
endpoints_api_comics.go Normal file
View File

@ -0,0 +1,91 @@
package main
import (
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/gorilla/mux"
)
func handleApiComicsCall(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "application/json")
vars := mux.Vars(req)
cid, cidok := vars["cid"]
fn, fnok := vars["function"]
switch req.Method {
case "GET":
if !cidok {
handleApiListComics(w)
return
}
if !fnok {
handleApiShowComic(cid, w)
return
}
switch fn {
case "search":
handleApiSearchComic(cid, w)
return
default:
userError(w)
return
}
default:
userError(w)
return
}
}
func handleApiListComics(w http.ResponseWriter) {
var res []byte
var err error
if res, err = json.Marshal(m.Comics); err != nil {
serverError(w)
return
}
fmt.Fprint(w, string(res))
}
func handleApiSearchComic(nm string, w http.ResponseWriter) {
nm = strings.ToLower(nm)
var cs []Comic
for _, c := range m.Comics {
if strings.Contains(strings.ToLower(c.Name), nm) {
cs = append(cs, c)
}
}
var res []byte
var err error
if res, err = json.Marshal(cs); err != nil {
serverError(w)
return
}
fmt.Fprint(w, string(res))
}
func handleApiShowComic(cid string, w http.ResponseWriter) {
var err error
var c *Comic
pts := strings.Split(cid, ";")
if len(pts) != 2 {
userError(w)
return
}
if c, err = m.GetComic(pts[0], pts[1]); err != nil {
userError(w)
return
}
var res []byte
if res, err = json.Marshal(c); err != nil {
userError(w)
return
}
fmt.Fprint(w, string(res))
return
}

View File

@ -125,7 +125,7 @@ func handleApiSubUser(uid string, slug string, w http.ResponseWriter) {
userError(w)
return
}
//_, err = m.GetComic(pts[0], pts[1])
_, err = m.GetComic(pts[0], pts[1])
if err != nil {
userError(w)
return

View File

@ -1,18 +1,39 @@
package main
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)
func handleRequest(w http.ResponseWriter, req *http.Request) {
page := initPageData(w, req)
vars := mux.Vars(req)
//vars := mux.Vars(req)
//var fOk, uidOk bool
//var f, uid string
//f, fOk = vars["function"]
//uid, uidOk = vars[""]
if !page.LoggedIn {
handleUserLoginForm(page)
var fOk, uidOk bool
var f, uid string
f, fOk = vars["function"]
uid, uidOk = vars["uid"]
if !fOk || !uidOk {
// Not sure what you want me to do here, Hoss.
http.Error(w, "You did a bad", 400)
return
}
switch f {
case "rss":
handleRssFeed(uid, w)
default:
http.Error(w, "You did a bad", 400)
}
}
func handleRssFeed(uid string, w http.ResponseWriter) {
w.Header().Set("Content-Type", "application/xml")
v, err := buildRssFeed(uid)
if err != nil {
http.Error(w, err.Error(), 400)
return
}
fmt.Fprint(w, v)
}

View File

@ -1,73 +0,0 @@
package main
import (
"net/http"
"strings"
"time"
"github.com/gorilla/mux"
)
func handleRssFeed(w http.ResponseWriter, req *http.Request) {
page := initPageData(w, req)
vars := mux.Vars(req)
var uid string
var uidOk bool
if uid, uidOk = vars["uid"]; !uidOk {
userError(w)
return
}
w.Header().Set("Content-Type", "application/xml")
var slug string
var slugOk bool
slug, slugOk = vars["slug"]
if !slugOk {
// Print the user's entire feed
buildUserRssFeed(page, uid)
} else {
// Print the feed for a specific slug
buildSlugRssFeed(page, uid, slug)
}
}
type rssPageData struct {
User *User
Feeds []Feed
BuildDate time.Time
}
func buildUserRssFeed(page *pageData, uid string) {
var err error
rpd := new(rssPageData)
rpd.BuildDate = time.Now()
rpd.User, err = m.GetUser(uid)
if err != nil {
userError(page.session.w)
return
}
for _, v := range rpd.User.SubSlugs {
pts := strings.Split(v, ";")
fd, err := m.GetFeed(pts[0], pts[1])
if err != nil {
userError(page.session.w)
return
}
rpd.Feeds = append(rpd.Feeds, *fd)
}
page.TemplateData = rpd
page.showRss()
}
func buildSlugRssFeed(page *pageData, uid, slug string) {
var err error
rpd := new(rssPageData)
rpd.BuildDate = time.Now()
rpd.User, err = m.GetUser(uid)
if err != nil {
userError(page.session.w)
return
}
page.TemplateData = rpd
page.showRss()
}

View File

@ -1,141 +0,0 @@
package main
import (
"errors"
"fmt"
"net/http"
"strings"
"github.com/gorilla/mux"
)
func handleUserRequest(w http.ResponseWriter, req *http.Request) {
page := initPageData(w, req)
vars := mux.Vars(req)
f, fOk := vars["function"]
if fOk && f == "login" {
handleUserLogin(page)
return
}
if !page.LoggedIn {
page.SubTitle = "ribbit login"
page.show("login.html")
return
}
switch f {
case "feeds":
handleUserFeeds(page)
case "updatesubscriptions":
handleUpdateUserSubs(page)
default:
handleUserDashboard(page)
}
}
func handleUserLoginForm(page *pageData) {
page.SubTitle = "ribbit login"
page.show("login.html")
}
func handleUserLogin(page *pageData) {
var err error
var u *User
if page.LoggedIn {
redirect("/", page.session.w, page.session.req)
}
email := page.session.req.FormValue("email")
if u, err = m.GetUserByEmail(email); err != nil {
page.session.setFlashMessage("Invalid Login", "error")
redirect("/", page.session.w, page.session.req)
return
}
password := page.session.req.FormValue("password")
fmt.Println("Hitting func")
if err := doLogin(u.Uuid, password); err != nil {
fmt.Println("Login Failure: ", err.Error())
page.session.setFlashMessage("Invalid Login", "error")
} else {
page.session.setStringValue("id", u.Uuid)
}
redirect("/", page.session.w, page.session.req)
}
// doLogin attempts to log in with the given email/password
// If it can't, it returns an error
func doLogin(uid, password string) error {
if strings.TrimSpace(uid) != "" && strings.TrimSpace(password) != "" {
return m.checkCredentials(uid, password)
}
return errors.New("Invalid Credentials")
}
func handleUserDashboard(page *pageData) {
page.SubTitle = "dashboard"
var err error
id, err := page.session.getStringValue("id")
if err != nil {
userError(page.session.w)
return
}
page.TemplateData, err = m.GetUser(id)
if err != nil {
userError(page.session.w)
return
}
page.show("user_dashboard.html")
}
func handleUserFeeds(page *pageData) {
page.SubTitle = "feeds"
type feedsPageData struct {
User *User
FeedSources []FeedSource
}
fpd := new(feedsPageData)
fpd.FeedSources = m.FeedSources
id, err := page.session.getStringValue("id")
if err != nil {
userError(page.session.w)
return
}
fpd.User, err = m.GetUser(id)
if err != nil {
userError(page.session.w)
return
}
page.TemplateData = fpd
page.show("user_feeds.html")
}
func handleUpdateUserSubs(page *pageData) {
subs := page.session.req.FormValue("user_feeds")
fmt.Println(subs)
subPts := strings.Split(subs, ",")
var userSubs []string
for i := range subPts {
subPts[i] = strings.TrimSpace(subPts[i])
if subPts[i] != "" {
userSubs = append(userSubs, subPts[i])
}
}
id, err := page.session.getStringValue("id")
if err != nil {
userError(page.session.w)
return
}
var u *User
u, err = m.GetUser(id)
u.SubSlugs = userSubs
m.SaveUser(u)
for k := range m.Users {
if m.Users[k].Uuid == id {
m.Users[k].SubSlugs = userSubs
}
}
redirect("/user/dashboard", page.session.w, page.session.req)
}

68
helper_dilbert.go Normal file
View File

@ -0,0 +1,68 @@
package main
import (
"errors"
"fmt"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
)
func downloadDilbertList() []Comic {
var ret []Comic
ret = append(ret, *NewComic("dilbert", "Dilbert", "Scott Adams", "dilbert"))
return ret
}
func getDilbertRssItem(slug string) (string, error) {
desc, err := getDilbertFeedDesc(time.Now())
if err != nil {
return "", err
}
comic, err := m.GetComic(SRC_DILBERT, slug)
if err != nil {
return "", err
}
desc = "<![CDATA[" + desc + "]]>"
ret := " <item>\n"
ret += " <title>" + comic.Name + "</title>\n"
ret += " <pubDate>" + comic.LastUpdate.Format(time.RFC1123Z) + "</pubDate>\n"
ret += " <guid>dilbert;" + slug + ";" + comic.LastUpdate.Format(time.RFC1123Z) + "</guid>\n"
ret += " <link>" + getDilbertComicUrl(time.Now()) + "</link>\n"
ret += " <description>" + desc + "</description>\n"
ret += " </item>\n"
return ret, nil
}
func getDilbertComicUrl(date time.Time) string {
return fmt.Sprintf(
"http://dilbert.com/strip/%4d-%02d-%02d",
date.Year(),
date.Month(),
date.Day(),
)
}
func getDilbertFeedDesc(date time.Time) (string, error) {
res, err := http.Get(getDilbertComicUrl(date))
if err != nil {
return "", err
}
defer res.Body.Close()
if res.StatusCode != 200 {
return "", errors.New(fmt.Sprintf("Status code error: %d %s", res.StatusCode, res.Status))
}
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return "", err
}
// Find the Picture
src, exists := doc.Find("img.img-comic").Attr("src")
if !exists {
return "", errors.New("Couldn't find image source")
}
return "<img src=\"https:" + src + "\" />", nil
}

View File

@ -1,7 +1,6 @@
package main
import (
"C"
"errors"
"fmt"
"net/http"
@ -11,12 +10,8 @@ import (
"github.com/PuerkitoBio/goquery"
)
func GetSourceName() string {
return "gocomics"
}
func GetFeedList() []map[string]string {
var ret []map[string]string
func downloadGoComicsList() []Comic {
var ret []Comic
lstUrl := "http://www.gocomics.com/comics/a-to-z"
res, err := http.Get(lstUrl)
if err != nil {
@ -52,33 +47,44 @@ func GetFeedList() []map[string]string {
}
author = strings.TrimPrefix(author, "By ")
author = strings.Replace(author, "\u0026", "&", -1)
feedMap := make(map[string]string)
feedMap["slug"] = slug
feedMap["name"] = name
feedMap["author"] = author
feedMap["source"] = GetSourceName()
ret = append(ret, feedMap)
ret = append(ret, *NewComic(slug, name, author, "gocomics"))
}
})
return ret
}
func GetFeedUrl(slug string, date time.Time) (string, error) {
func getGoComicsRssItem(slug string) (string, error) {
desc, err := getGoComicsFeedDesc(slug, time.Now())
if err != nil {
return "", err
}
comic, err := m.GetComic(SRC_GOCOMICS, slug)
if err != nil {
return "", err
}
desc = "<![CDATA[" + desc + "]]>"
ret := " <item>\n"
ret += " <title>" + comic.Name + "</title>\n"
ret += " <pubDate>" + comic.LastUpdate.Format(time.RFC1123Z) + "</pubDate>\n"
ret += " <guid>gocomics;" + slug + ";" + comic.LastUpdate.Format(time.RFC1123Z) + "</guid>\n"
ret += " <link>" + getGoComicsComicUrl(slug, time.Now()) + "</link>\n"
ret += " <description>" + desc + "</description>\n"
ret += " </item>\n"
return ret, nil
}
func getGoComicsComicUrl(slug string, date time.Time) string {
return fmt.Sprintf(
"http://www.gocomics.com/%s/%04d/%02d/%02d",
slug,
date.Year(),
date.Month(),
date.Day(),
), nil
)
}
func GetFeedDesc(slug string, date time.Time) (string, error) {
url, err := GetFeedUrl(slug, date)
if err != nil {
return "", err
}
res, err := http.Get(url)
func getGoComicsFeedDesc(slug string, date time.Time) (string, error) {
res, err := http.Get(getGoComicsComicUrl(slug, date))
if err != nil {
return "", err
}

74
helper_xkcd.go Normal file
View File

@ -0,0 +1,74 @@
package main
import (
"errors"
"fmt"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
)
func downloadXKCDList() []Comic {
var ret []Comic
ret = append(ret, *NewComic("xkcd", "XKCD", "Randall Munroe", "xkcd"))
return ret
}
func getXKCDRssItem(slug string) (string, error) {
desc, err := getXKCDFeedDesc(time.Now())
if err != nil {
return "", err
}
comic, err := m.GetComic(SRC_XKCD, slug)
if err != nil {
return "", err
}
desc = "<![CDATA[" + desc + "]]>"
ret := " <item>\n"
ret += " <title>" + comic.Name + "</title>\n"
ret += " <pubDate>" + comic.LastUpdate.Format(time.RFC1123Z) + "</pubDate>\n"
ret += " <guid>xkcd;" + slug + ";" + comic.LastUpdate.Format(time.RFC1123Z) + "</guid>\n"
ret += " <link>" + getXKCDComicUrl(time.Now()) + "</link>\n"
ret += " <description>" + desc + "</description>\n"
ret += " </item>\n"
return ret, nil
}
func getXKCDComicUrl(date time.Time) string {
// TODO: Actually make this work correctly
// Get the previous comic number
// and find the next one
return fmt.Sprintf(
"http://xkcd.com/",
)
}
func getXKCDFeedDesc(date time.Time) (string, error) {
res, err := http.Get(getXKCDComicUrl(date))
if err != nil {
return "", err
}
defer res.Body.Close()
if res.StatusCode != 200 {
return "", errors.New(fmt.Sprintf("Status code error: %d %s", res.StatusCode, res.Status))
}
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return "", err
}
// Find the Picture
sel := doc.Find("div#comic>img")
src, exists := sel.Attr("src")
if !exists {
return "", errors.New("Couldn't find image source")
}
src = "https:" + src
title, exists := sel.Attr("title")
if !exists {
title = ""
}
return "<img src=\"" + src + "\" /><p>" + title + "</p>", nil
}

View File

@ -1,9 +1,98 @@
package main
import (
"errors"
"net/http"
"strings"
"time"
)
const (
SRC_GOCOMICS = "gocomics"
SRC_DILBERT = "dilbert"
SRC_XKCD = "xkcd"
)
func downloadComicsList() []Comic {
var ret []Comic
ret = append(ret, downloadGoComicsList()...)
ret = append(ret, downloadDilbertList()...)
ret = append(ret, downloadXKCDList()...)
return ret
}
func getRssItem(source, slug string) (string, error) {
switch source {
case SRC_GOCOMICS:
return getGoComicsRssItem(slug)
case SRC_DILBERT:
return getDilbertRssItem(slug)
case SRC_XKCD:
return getXKCDRssItem(slug)
}
return "", errors.New("Invalid source")
}
func getComicUrl(source, slug string, dt time.Time) (string, error) {
switch source {
case SRC_GOCOMICS:
return getGoComicsComicUrl(slug, dt), nil
case SRC_DILBERT:
return getDilbertComicUrl(dt), nil
case SRC_XKCD:
return getXKCDComicUrl(dt), nil
}
return "", errors.New("Invalid source")
}
func getComicDesc(source, slug string, dt time.Time) (string, error) {
switch source {
case SRC_GOCOMICS:
return getGoComicsFeedDesc(slug, dt)
case SRC_DILBERT:
return getDilbertFeedDesc(dt)
case SRC_XKCD:
return getXKCDFeedDesc(dt)
}
return "", errors.New("Unknown Comic Source")
}
func buildRssFeed(uid string) (string, error) {
var usr *User
var err error
if usr, err = m.GetUser(uid); err != nil {
return "", err
}
output := []string{
"<?xml version=\"1.0\"?>",
"<rss version=\"2.0\">",
" <channel>",
" <title>BCW Comic Feed</title>",
" <link>http://ribbit.bullercodeworks.com/edit/" + uid + "</link>",
" <description>Comic feed for " + usr.Username + "</description>",
" <language>en-us</language>",
" <lastBuildDate>" + time.Now().Format(time.RFC1123) + "</lastBuildDate>",
" <ttl>40</ttl>",
}
//date := time.Now()
for _, slug := range usr.SubSlugs {
pts := strings.Split(slug, ";")
if len(pts) != 2 {
continue
}
if comic, err := m.GetComic(pts[0], pts[1]); err == nil {
output = append(output, comic.GetRssItem())
}
}
output = append(output, []string{
" </channel>",
"</rss>",
}...)
return strings.Join(output, "\n"), nil
}
func addStringIfUnique(st string, sl []string) []string {
for i := range sl {
if sl[i] == st {

217
main.go
View File

@ -1,37 +1,25 @@
package main
//go:generate esc -o assets.go assets templates
import (
"bufio"
"fmt"
"html/template"
"io/ioutil"
"log"
"net/http"
"os"
"os/signal"
"plugin"
"strconv"
"strings"
"syscall"
"time"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/gorilla/sessions"
"github.com/justinas/alice"
"golang.org/x/crypto/ssh/terminal"
)
const AppName = "ribbit"
const DbName = AppName + ".db"
type menuItem struct {
Label string
Location string
Icon string
}
var sessionStore *sessions.CookieStore
var r *mux.Router
var m *model
@ -44,24 +32,72 @@ func main() {
errorExit("Unable to initialize Model: " + err.Error())
}
initialize()
sessionStore = sessions.NewCookieStore([]byte(m.Site.sessionSecret))
if len(os.Args) > 2 {
key, val := os.Args[1], os.Args[2]
switch key {
case "--add-user-sub":
if len(os.Args) < 3 {
errorExit("Usage: --add-user-sub <username> <comic-slug>\nFor a list of slugs, use --list-comics")
}
slug := os.Args[3]
var u *User
if u, err = m.GetUserByName(val); err != nil {
errorExit("Couldn't find a user with the username " + val)
}
pts := strings.Split(slug, ";")
if len(pts) != 2 {
errorExit("Invalid slug given: " + slug)
}
_, err := m.GetComic(pts[0], pts[1])
if err != nil {
errorExit("Couldn't find comic with slug: " + slug)
}
fmt.Println(u.SubSlugs)
fmt.Println(slug)
u.SubSlugs = append(u.SubSlugs, slug)
fmt.Println(u.SubSlugs)
m.SaveUser(u)
done()
default:
errorExit("Unknown argument")
}
} else if len(os.Args) > 1 {
switch os.Args[1] {
case "--test":
fmt.Println(buildRssFeed("30f14e57-6500-443c-8c77-f352788eacb0"))
done()
case "--list-comics":
comics := m.GetAllComics()
for _, c := range comics {
fmt.Printf("[ %s;%s ] %s\n", c.Source, c.Slug, c.Name)
}
done()
case "--update-feeds":
fmt.Println("Updating User Feeds...")
m.UpdateAllUserFeeds()
fmt.Println("Done.")
done()
case "--update-comics":
fmt.Println("Updating the Comics List...")
comics := downloadComicsList()
for _, c := range comics {
fmt.Printf("Updating [ %s - %s, %s ]\n", c.Slug, c.Name, c.Artist)
m.SaveComic(&c)
}
m.saveChanges()
fmt.Println("Done.")
for _, arg := range os.Args {
switch arg {
case "-dev":
m.Site.DevMode = true
fmt.Println("Running in Dev Mode")
default:
errorExit("Unknown argument")
}
}
r = mux.NewRouter()
r.StrictSlash(true)
r.PathPrefix("/assets/").Handler(http.FileServer(FS(m.Site.DevMode)))
//r.PathPrefix("/assets/").Handler(http.FileServer())
pub := r.PathPrefix("/").Subrouter()
pub.HandleFunc("/", handleUserRequest)
/*
pub.HandleFunc("/", handleRequest)
pub.HandleFunc("/api", handleApiCall)
pub.HandleFunc("/api/users", handleApiUsersCall)
pub.HandleFunc("/api/users/{uid}", handleApiUsersCall)
@ -70,16 +106,15 @@ func main() {
pub.HandleFunc("/api/comics", handleApiComicsCall)
pub.HandleFunc("/api/comics/{cid}", handleApiComicsCall)
pub.HandleFunc("/api/comics/{cid}/{function}", handleApiComicsCall)
*/
pub.HandleFunc("/rss/{uid}", handleRssFeed)
pub.HandleFunc("/rss/{uid}/{slug}", handleRssFeed)
pub.HandleFunc("/user/{function}", handleUserRequest)
pub.HandleFunc("/{function}", handleRequest)
pub.HandleFunc("/{function}/{uid}", handleRequest)
pub.HandleFunc("/{function}/{uid}/{subfunc}", handleRequest)
pub.HandleFunc("/{function}/{uid}/{subfunc}/{slug}", handleRequest)
http.Handle("/", r)
chain := alice.New(loggingHandler).Then(r)
// Refresh the DB at 2 AM
/*
go func() {
for {
if m.Site.LastSave.IsZero() || (time.Now().Day() != m.Site.LastSave.Day() && time.Now().Hour() == 2) {
@ -97,7 +132,6 @@ func main() {
time.Sleep(time.Minute)
}
}()
*/
// Set up a channel to intercept Ctrl+C for graceful shutdowns
c := make(chan os.Signal, 1)
@ -118,73 +152,6 @@ func loggingHandler(h http.Handler) http.Handler {
return handlers.LoggingHandler(os.Stdout, h)
}
func initPageData(w http.ResponseWriter, req *http.Request) *pageData {
if m.Site.DevMode {
w.Header().Set("Cache-Control", "no-cache")
}
p := new(pageData)
// Get session
var err error
var s *sessions.Session
if s, err = sessionStore.Get(req, m.Site.sessionSecret); err != nil {
fmt.Println("Session error... Recreating.")
http.Error(w, err.Error(), 500)
}
p.session = new(pageSession)
p.session.session = s
p.session.req = req
p.session.w = w
// First check if we're logged in
userId, _ := p.session.getStringValue("id")
// With a valid account
user, err := m.GetUser(userId)
if err == nil {
p.LoggedIn = true
p.IsAdmin = user.IsAdmin
}
p.Site = m.Site
p.SubTitle = "ribbit"
p.Stylesheets = make([]string, 0, 0)
p.Stylesheets = append(p.Stylesheets, "/assets/vendor/css/pure-min.css")
p.Stylesheets = append(p.Stylesheets, "/assets/vendor/css/grids-responsive-min.css")
p.Stylesheets = append(p.Stylesheets, "/assets/css/main.css")
p.HeaderScripts = make([]string, 0, 0)
p.Scripts = make([]string, 0, 0)
p.FlashMessage, p.FlashClass = p.session.getFlashMessage()
if p.FlashClass == "" {
p.FlashClass = "hidden"
}
// Build the menu
if p.LoggedIn {
p.BottomMenu = append(p.BottomMenu, menuItem{"Logout", "/user/logout", "fa-sign-out"})
} else {
if p.IsAdmin {
p.BottomMenu = append(p.BottomMenu, menuItem{"Admin", "/admin", "fa-sign-in"})
}
}
return p
}
func outputTemplate(tmplName string, tmplData interface{}, w http.ResponseWriter) error {
n := "/templates/" + tmplName
l := template.Must(template.New("layout").Parse(FSMustString(m.Site.DevMode, n)))
t := template.Must(l.Parse(FSMustString(m.Site.DevMode, n)))
return t.Execute(w, tmplData)
}
// redirect can be used only for GET redirects
func redirect(url string, w http.ResponseWriter, req *http.Request) {
http.Redirect(w, req, url, 303)
}
func done() {
os.Exit(0)
}
@ -199,61 +166,3 @@ func assertError(err error) {
panic(err)
}
}
func initialize() {
// Check if we have an admin user already
if !m.hasAdminUser() {
// Nope, create one
reader := bufio.NewReader(os.Stdin)
fmt.Println("Create new Admin user")
fmt.Print("Email: ")
email, _ := reader.ReadString('\n')
email = strings.TrimSpace(email)
u := NewUser(email)
var pw1, pw2 []byte
for string(pw1) != string(pw2) || string(pw1) == "" {
fmt.Print("Password: ")
pw1, _ = terminal.ReadPassword(0)
fmt.Println("")
fmt.Print("Repeat Password: ")
pw2, _ = terminal.ReadPassword(0)
fmt.Println("")
if string(pw1) != string(pw2) {
fmt.Println("Entered Passwords don't match!")
}
}
u.IsAdmin = true
m.SaveUser(u)
assertError(m.updateUserPassword(u.Uuid, string(pw1)))
}
if m.Site.sessionSecret == "" {
reader := bufio.NewReader(os.Stdin)
fmt.Println("A good session secret is like a good password")
fmt.Print("Create New Session Secret: ")
sessSc, _ := reader.ReadString('\n')
sessSc = strings.TrimSpace(sessSc)
m.Site.sessionSecret = sessSc
assertError(m.Site.SaveToDB())
}
// Load Feed Sources from Plugins
files, err := ioutil.ReadDir("./plugins/")
if err != nil {
log.Fatal(err)
}
for _, f := range files {
fmt.Print("Loading plugin ", f.Name(), "...")
p, err := plugin.Open("./plugins/" + f.Name())
if err != nil {
panic(err)
}
var feedSource *FeedSource
if feedSource, err = LoadFeedPlugin(p); err != nil {
fmt.Println(" ", err.Error())
continue
}
m.FeedSources = append(m.FeedSources, *feedSource)
fmt.Printf("Done. (%d feeds)\n", len(feedSource.Feeds))
}
}

View File

@ -10,14 +10,11 @@ import (
)
type model struct {
dbOpen int
bolt *boltease.DB
dbFileName string
dbChanged bool
Users []User
FeedSources []FeedSource
Feeds []Feed
Comics []Comic
Site *SiteData
}
@ -34,14 +31,11 @@ func NewModel() (*model, error) {
if err = m.initDB(); err != nil {
return nil, errors.New("Unable to initialzie DB: " + err.Error())
}
m.Site = NewSiteData(m)
if err = m.Site.LoadFromDB(); err != nil {
return nil, err
}
m.LoadSiteData()
if err = m.LoadUsers(); err != nil {
return nil, err
}
if err = m.LoadFeeds(); err != nil {
if err = m.LoadComics(); err != nil {
return nil, err
}
@ -50,10 +44,10 @@ func NewModel() (*model, error) {
func (m *model) initDB() error {
var err error
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return err
}
defer m.closeDB()
defer m.bolt.CloseDB()
if err = m.bolt.MkBucketPath([]string{"site"}); err != nil {
return err
@ -61,37 +55,16 @@ func (m *model) initDB() error {
if err = m.bolt.MkBucketPath([]string{"users"}); err != nil {
return err
}
if err = m.bolt.MkBucketPath([]string{"feeds"}); err != nil {
if err = m.bolt.MkBucketPath([]string{"comics"}); err != nil {
return err
}
return nil
}
func (m *model) openDB() error {
m.dbOpen = m.dbOpen + 1
if m.dbOpen > 1 {
return nil
}
var err error
if err = m.openDB(); err != nil {
return err
}
return nil
}
func (m *model) closeDB() {
m.dbOpen = m.dbOpen - 1
if m.dbOpen == 0 {
m.closeDB()
}
}
func (m *model) saveChanges() {
fmt.Println("Saving Site to DB")
m.Site.SaveToDB()
//fmt.Println("Saving Feeds to DB")
//m.SaveAllFeeds(m.FeedSources)
fmt.Println("Saving Users to DB")
m.Site.LastSave = time.Now()
m.SaveSite()
//m.SaveAllComics(m.Comics)
m.SaveAllUsers(m.Users)
}
@ -103,14 +76,14 @@ func (m *model) UpdateAllUserFeeds() {
allSubs = addStringIfUnique(sub, allSubs)
}
}
// So we have allSubs which contains all subscribed feeds for all users
// So we have allSubs which contains all subscribed comics for all users
for _, sub := range allSubs {
fmt.Println("Updating Feed: " + sub)
fmt.Println("Updating Comic: " + sub)
pts := strings.Split(sub, ";")
if len(pts) != 2 {
continue
}
c, err := m.GetFeed(pts[0], pts[1])
c, err := m.GetComic(pts[0], pts[1])
if err != nil {
fmt.Println(sub, ":", err)
continue
@ -119,7 +92,7 @@ func (m *model) UpdateAllUserFeeds() {
fmt.Println(sub, ":", err.Error())
continue
}
if err = m.SaveFeed(c); err != nil {
if err = m.SaveComic(c); err != nil {
fmt.Println(sub, ":", err.Error())
continue
}
@ -127,7 +100,7 @@ func (m *model) UpdateAllUserFeeds() {
}
type Source interface {
downloadList() []Feed
downloadList() []Comic
getRssItem(slug string) (string, error)
getUrl(slug string, dt time.Time) (string, error)
getDescription(slug string, dt time.Time) (string, error)

202
model_comics.go Normal file
View File

@ -0,0 +1,202 @@
package main
import (
"errors"
"time"
)
type Comic struct {
Name string
Artist string
Slug string
Source string
Desc string
LastUpdate time.Time
}
func NewComic(s, n, a, source string) *Comic {
return &Comic{
Name: n,
Artist: a,
Slug: s,
Source: source,
}
}
func (c *Comic) GetBucket() []string {
return []string{"comics", c.Source, c.Slug}
}
func (c *Comic) Update() error {
dt := time.Now()
desc, err := getComicDesc(c.Source, c.Slug, dt)
if err != nil {
return err
}
if desc == c.Desc {
return errors.New("Comic didn't change")
}
c.Desc = desc
c.LastUpdate = dt
return nil
}
func (c *Comic) GetUrl(dt time.Time) string {
var v string
var e error
if v, e = getComicUrl(c.Source, c.Slug, dt); e != nil {
return ""
}
return v
}
func (c *Comic) GetDesc(dt time.Time) string {
var v string
var e error
if v, e = getComicDesc(c.Source, c.Slug, dt); e != nil {
return ""
}
return v
}
func (c *Comic) GetRssItem() string {
var v string
var e error
if v, e = getRssItem(c.Source, c.Slug); e != nil {
return ""
}
return v
}
// DB Function to save a comic
func (m *model) SaveComic(c *Comic) error {
var err error
if err = m.bolt.OpenDB(); err != nil {
return err
}
defer m.bolt.CloseDB()
bkt := c.GetBucket()
if err = m.bolt.MkBucketPath(bkt); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "name", c.Name); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "artist", c.Artist); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "desc", c.Desc); err != nil {
return err
}
if err = m.bolt.SetTimestamp(bkt, "lastupdate", c.LastUpdate); err != nil {
return err
}
// Add it to the cached list
for i, v := range m.Comics {
if v.Source == c.Source && v.Slug == c.Slug {
m.Comics[i] = *c
return nil
}
}
m.Comics = append(m.Comics, *c)
return nil
}
// DB Function to get a comic
func (m *model) GetComic(source, slug string) (*Comic, error) {
var err error
if err = m.bolt.OpenDB(); err != nil {
return nil, err
}
defer m.bolt.CloseDB()
ret := new(Comic)
ret.Source = source
ret.Slug = slug
bkt := ret.GetBucket()
if ret.Name, err = m.bolt.GetValue(bkt, "name"); err != nil {
return nil, err
}
if ret.Artist, err = m.bolt.GetValue(bkt, "artist"); err != nil {
return nil, err
}
if ret.Desc, err = m.bolt.GetValue(bkt, "desc"); err != nil {
return nil, err
}
if ret.LastUpdate, err = m.bolt.GetTimestamp(bkt, "lastupdate"); err != nil {
return nil, err
}
return ret, nil
}
// Load all comics into the model
func (m *model) LoadComics() error {
m.Comics = m.GetAllComics()
return nil
}
// Save all comics to the DB
func (m *model) SaveAllComics(comics []Comic) {
var err error
if err = m.bolt.OpenDB(); err != nil {
return
}
defer m.bolt.CloseDB()
for i := range comics {
m.SaveComic(&comics[i])
}
}
// Get all comics from the db
func (m *model) GetAllComics() []Comic {
var ret []Comic
var err error
if err = m.bolt.OpenDB(); err != nil {
return ret
}
defer m.bolt.CloseDB()
var srcs []string
bkt := []string{"comics"}
if srcs, err = m.bolt.GetBucketList(bkt); err != nil {
return ret
}
for _, src := range srcs {
srcBkt := append(bkt, src)
var slugs []string
if slugs, err = m.bolt.GetBucketList(srcBkt); err != nil {
return ret
}
for _, slg := range slugs {
c, err := m.GetComic(src, slg)
if err == nil {
ret = append(ret, *c)
}
}
}
return ret
}
// Delete a comic from the DB
func (m *model) DeleteComic(slug string) error {
var err error
if err = m.bolt.OpenDB(); err != nil {
return err
}
defer m.bolt.CloseDB()
return m.bolt.DeleteBucket([]string{"comics"}, slug)
}
func (m *model) RemoveMissingComics(comics []Comic) {
for _, c := range m.Comics {
var fnd bool
for _, nc := range comics {
if nc.Slug == c.Slug {
fnd = true
break
}
}
if !fnd {
m.DeleteComic(c.Slug)
}
}
}

View File

@ -1,281 +0,0 @@
package main
import (
"fmt"
"plugin"
"time"
)
type FeedSource struct {
Feeds []*Feed
// Plugin Functions
getSourceName func() string
refreshFeedList func() []map[string]string
getFeedUrl func(string, time.Time) (string, error)
getFeedDesc func(string, time.Time) (string, error)
}
func LoadFeedPlugin(p *plugin.Plugin) (*FeedSource, error) {
ret := new(FeedSource)
feedSourceSymbol, err := p.Lookup("GetSourceName")
if err != nil {
return nil, err
}
ret.getSourceName = feedSourceSymbol.(func() string)
feedListSymbol, err := p.Lookup("GetFeedList")
if err != nil {
return nil, err
}
ret.refreshFeedList = feedListSymbol.(func() []map[string]string)
feeds := ret.refreshFeedList()
// `feeds` is a []map, each map should contain keys: `slug`, `name`, `author`, `source`
for _, f := range feeds {
var slug, name, author, source string
var ok bool
if slug, ok = f["slug"]; !ok {
continue
}
if name, ok = f["name"]; !ok {
continue
}
if author, ok = f["author"]; !ok {
continue
}
if source, ok = f["source"]; !ok {
continue
}
ret.Feeds = append(ret.Feeds, NewFeed(slug, name, author, source))
}
feedUrlSymbol, err := p.Lookup("GetFeedUrl")
if err != nil {
return nil, err
}
ret.getFeedUrl = feedUrlSymbol.(func(string, time.Time) (string, error))
feedDescSymbol, err := p.Lookup("GetFeedDesc")
if err != nil {
return nil, err
}
ret.getFeedDesc = feedDescSymbol.(func(string, time.Time) (string, error))
return ret, nil
}
func (f *FeedSource) getFeed(slug string) *Feed {
for i := range f.Feeds {
if f.Feeds[i].Slug == slug {
return f.Feeds[i]
}
}
return nil
}
type Feed struct {
Name string
Author string
Slug string
Source string
Desc string
LastUpdate time.Time
}
func NewFeed(s, n, a, source string) *Feed {
return &Feed{
Name: n,
Author: a,
Slug: s,
Source: source,
}
}
func (f *Feed) GetBucket() []string {
return []string{"feeds", f.Source, f.Slug}
}
func (f *Feed) Update() error {
/*
dt := time.Now()
desc, err := getFeedDesc(f.Source, f.Slug, dt)
if err != nil {
return err
}
if desc == f.Desc {
return errors.New("Feed didn't change")
}
f.Desc = desc
f.LastUpdate = dt
*/
return nil
}
func (f *Feed) GetUrl(dt time.Time) string {
var v string
/*
var e error
if v, e = getFeedUrl(f.Source, f.Slug, dt); e != nil {
return ""
}
*/
return v
}
func (f *Feed) GetDesc(dt time.Time) string {
var v string
/*
var e error
if v, e = getFeedDesc(f.Source, f.Slug, dt); e != nil {
return ""
}
*/
return v
}
func (f *Feed) GetRssItem() string {
var v string
/*
var e error
if v, e = getRssItem(f.Source, f.Slug); e != nil {
return ""
}
*/
return v
}
// DB Function to save a feed
func (m *model) SaveFeed(f *Feed) error {
var err error
if err = m.openDB(); err != nil {
return err
}
defer m.closeDB()
bkt := f.GetBucket()
if err = m.bolt.MkBucketPath(bkt); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "name", f.Name); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "author", f.Author); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "desc", f.Desc); err != nil {
return err
}
if err = m.bolt.SetTimestamp(bkt, "lastupdate", f.LastUpdate); err != nil {
return err
}
// Add it to the cached list
for i, v := range m.Feeds {
if v.Source == f.Source && v.Slug == f.Slug {
m.Feeds[i] = *f
return nil
}
}
m.Feeds = append(m.Feeds, *f)
return nil
}
// DB Function to get a feed
func (m *model) GetFeed(source, slug string) (*Feed, error) {
var err error
if err = m.openDB(); err != nil {
return nil, err
}
defer m.closeDB()
ret := new(Feed)
ret.Source = source
ret.Slug = slug
bkt := ret.GetBucket()
if ret.Name, err = m.bolt.GetValue(bkt, "name"); err != nil {
return nil, err
}
if ret.Author, err = m.bolt.GetValue(bkt, "author"); err != nil {
return nil, err
}
if ret.Desc, err = m.bolt.GetValue(bkt, "desc"); err != nil {
return nil, err
}
if ret.LastUpdate, err = m.bolt.GetTimestamp(bkt, "lastupdate"); err != nil {
return nil, err
}
return ret, nil
}
// Load all feeds into the model
func (m *model) LoadFeeds() error {
m.Feeds = m.GetAllFeeds()
return nil
}
// Save all feeds to the DB
func (m *model) SaveAllFeeds(feedSources []FeedSource) {
var err error
if err = m.openDB(); err != nil {
return
}
defer m.closeDB()
for _, v := range feedSources {
for j := range v.Feeds {
fmt.Printf("Saving Feed to DB (%s;%s)\n", v.Feeds[j].Source, v.Feeds[j].Slug)
m.SaveFeed(v.Feeds[j])
}
}
}
// Get all feeds from the db
func (m *model) GetAllFeeds() []Feed {
var ret []Feed
var err error
if err = m.openDB(); err != nil {
return ret
}
defer m.closeDB()
var srcs []string
bkt := []string{"feeds"}
if srcs, err = m.bolt.GetBucketList(bkt); err != nil {
return ret
}
for _, src := range srcs {
srcBkt := append(bkt, src)
var slugs []string
if slugs, err = m.bolt.GetBucketList(srcBkt); err != nil {
return ret
}
for _, slg := range slugs {
c, err := m.GetFeed(src, slg)
if err == nil {
ret = append(ret, *c)
}
}
}
return ret
}
// Delete a feed from the DB
func (m *model) DeleteFeed(slug string) error {
var err error
if err = m.openDB(); err != nil {
return err
}
defer m.closeDB()
return m.bolt.DeleteBucket([]string{"feeds"}, slug)
}
func (m *model) RemoveMissingFeeds(feeds []Feed) {
for _, c := range m.Feeds {
var fnd bool
for _, nc := range feeds {
if nc.Slug == c.Slug {
fnd = true
break
}
}
if !fnd {
m.DeleteFeed(c.Slug)
}
}
}

86
model_site.go Normal file
View File

@ -0,0 +1,86 @@
package main
import "time"
type SiteData struct {
Title string
Port int
SessionName string
ServerDir string
SessionSecret string
LastSave time.Time
}
func NewSiteData() *SiteData {
ret := new(SiteData)
ret.Title = "BCW Comic Feed"
ret.Port = 8080
ret.SessionName = "bcw-comic-feed"
ret.ServerDir = "./"
return ret
}
func (m *model) LoadSiteData() {
m.Site = m.GetSite()
}
func (m *model) SaveSite() error {
var err error
if err = m.bolt.OpenDB(); err != nil {
return err
}
defer m.bolt.CloseDB()
bkt := []string{"site"}
if err = m.bolt.SetValue(bkt, "title", m.Site.Title); err != nil {
return err
}
if err = m.bolt.SetInt(bkt, "port", m.Site.Port); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "session-name", m.Site.SessionName); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "session-secret", m.Site.SessionSecret); err != nil {
return err
}
if err = m.bolt.SetValue(bkt, "server-dir", m.Site.ServerDir); err != nil {
return err
}
if err = m.bolt.SetTimestamp(bkt, "last-save", m.Site.LastSave); err != nil {
return err
}
return nil
}
func (m *model) GetSite() *SiteData {
s := NewSiteData()
var err error
if err = m.bolt.OpenDB(); err != nil {
return s
}
defer m.bolt.CloseDB()
bkt := []string{"site"}
var wrkStr string
var wrkInt int
var wrkTm time.Time
if wrkStr, err = m.bolt.GetValue(bkt, "title"); err == nil {
s.Title = wrkStr
}
if wrkInt, err = m.bolt.GetInt(bkt, "port"); err == nil {
s.Port = wrkInt
}
if wrkStr, err = m.bolt.GetValue(bkt, "session-name"); err == nil {
s.SessionName = wrkStr
}
if wrkStr, err = m.bolt.GetValue(bkt, "session-secret"); err == nil {
s.SessionSecret = wrkStr
}
if wrkStr, err = m.bolt.GetValue(bkt, "server-dir"); err == nil {
s.ServerDir = wrkStr
}
if wrkTm, err = m.bolt.GetTimestamp(bkt, "last-save"); err == nil {
s.LastSave = wrkTm
}
return s
}

View File

@ -1,106 +0,0 @@
package main
import (
"strings"
"time"
)
/**
* SiteData
* Contains configuration for the website
*/
type SiteData struct {
Title string
Ip string
Port int
SessionName string
ServerDir string
DevMode bool
m *model
mPath []string // The path in the db to this site data
changed bool
lastSave time.Time
sessionSecret string
}
// NewSiteData returns a SiteData object with the default values
func NewSiteData(m *model) *SiteData {
ret := new(SiteData)
ret.Title = "ribbit"
ret.Ip = "127.0.0.1"
ret.Port = 8080
ret.SessionName = "good-ol-ribbit"
ret.ServerDir = "./"
ret.mPath = []string{"site"}
ret.m = m
return ret
}
// load the site data out of the database
// If fields don't exist in the DB, don't clobber what is already in s
func (s *SiteData) LoadFromDB() error {
if err := s.m.openDB(); err != nil {
return err
}
defer s.m.closeDB()
if title, _ := s.m.bolt.GetValue(s.mPath, "title"); strings.TrimSpace(title) != "" {
s.Title = title
}
if ip, err := s.m.bolt.GetValue(s.mPath, "ip"); err == nil {
s.Ip = ip
}
if port, err := s.m.bolt.GetInt(s.mPath, "port"); err == nil {
s.Port = port
}
if sessionName, _ := s.m.bolt.GetValue(s.mPath, "session-name"); strings.TrimSpace(sessionName) != "" {
s.SessionName = sessionName
}
if serverDir, _ := s.m.bolt.GetValue(s.mPath, "server-dir"); strings.TrimSpace(serverDir) != "" {
s.ServerDir = serverDir
}
s.changed = false
if secret, _ := s.m.bolt.GetValue(s.mPath, "session-secret"); strings.TrimSpace(secret) != "" {
s.sessionSecret = secret
}
return nil
}
// Return if the site data in memory has changed
func (s *SiteData) NeedsSave() bool {
return s.changed
}
// Save the site data into the DB
func (s *SiteData) SaveToDB() error {
s.lastSave = time.Now()
var err error
if err = s.m.openDB(); err != nil {
return err
}
defer s.m.closeDB()
if err = s.m.bolt.SetValue(s.mPath, "title", s.Title); err != nil {
return err
}
if err = s.m.bolt.SetValue(s.mPath, "ip", s.Ip); err != nil {
return err
}
if err = s.m.bolt.SetInt(s.mPath, "port", s.Port); err != nil {
return err
}
if err = s.m.bolt.SetValue(s.mPath, "session-name", s.SessionName); err != nil {
return err
}
if err = s.m.bolt.SetValue(s.mPath, "server-dir", s.ServerDir); err != nil {
return err
}
s.changed = false
if err = s.m.bolt.SetValue(s.mPath, "session-secret", s.sessionSecret); err != nil {
return err
}
return nil
}

View File

@ -6,14 +6,12 @@ import (
"strings"
"github.com/pborman/uuid"
"golang.org/x/crypto/bcrypt"
)
type User struct {
Username string `json:username`
Uuid string `json:uuid`
SubSlugs []string `json:subs`
IsAdmin bool `json:admin`
}
func NewUser(un string) *User {
@ -23,7 +21,6 @@ func NewUser(un string) *User {
return u
}
/*
func (u *User) UpdateFeed() error {
for _, slug := range u.SubSlugs {
pts := strings.Split(slug, ";")
@ -36,14 +33,13 @@ func (u *User) UpdateFeed() error {
}
return nil
}
*/
func (m *model) SaveUser(u *User) error {
var err error
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return err
}
defer m.closeDB()
defer m.bolt.CloseDB()
bkt := []string{"users", u.Uuid}
if err = m.bolt.MkBucketPath(bkt); err != nil {
return err
@ -51,13 +47,6 @@ func (m *model) SaveUser(u *User) error {
if err = m.bolt.SetValue(bkt, "username", u.Username); err != nil {
return err
}
var adminVal = "false"
if u.IsAdmin {
adminVal = "true"
}
if err = m.bolt.SetValue(bkt, "admin", adminVal); err != nil {
return err
}
var newSubs []string
for _, v := range u.SubSlugs {
if strings.TrimSpace(v) != "" {
@ -71,44 +60,12 @@ func (m *model) SaveUser(u *User) error {
return nil
}
func (m *model) isValidUser(uid string) bool {
var err error
if err = m.openDB(); err != nil {
return false
}
defer m.closeDB()
ret := new(User)
bkt := []string{"users", uid}
ret.Uuid = uid
if ret.Username, err = m.bolt.GetValue(bkt, "username"); err != nil {
fmt.Println("Error getting username value:", err.Error())
return false
}
return true
}
func (m *model) GetUserByEmail(email string) (*User, error) {
if email == "" {
return nil, errors.New("No email given")
}
u := m.GetAllUsers()
for i := range u {
if u[i].Username == email {
return &u[i], nil
}
}
return nil, errors.New("No user found")
}
func (m *model) GetUser(uid string) (*User, error) {
if uid == "" {
return nil, errors.New("No user id given")
}
var err error
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return nil, err
}
defer m.closeDB()
defer m.bolt.CloseDB()
ret := new(User)
bkt := []string{"users", uid}
ret.Uuid = uid
@ -116,8 +73,6 @@ func (m *model) GetUser(uid string) (*User, error) {
fmt.Println("Error getting username value:", err.Error())
return nil, err
}
admin, _ := m.bolt.GetValue(bkt, "admin")
ret.IsAdmin = (admin == "true")
var subs string
if subs, err = m.bolt.GetValue(bkt, "subs"); err != nil {
return nil, err
@ -128,10 +83,10 @@ func (m *model) GetUser(uid string) (*User, error) {
func (m *model) SaveAllUsers(users []User) {
var err error
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return
}
defer m.closeDB()
defer m.bolt.CloseDB()
for i := range users {
m.SaveUser(&users[i])
}
@ -145,10 +100,10 @@ func (m *model) LoadUsers() error {
func (m *model) GetAllUsers() []User {
var err error
var ret []User
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return ret
}
defer m.closeDB()
defer m.bolt.CloseDB()
uids := m.GetUserIdList()
for _, uid := range uids {
@ -161,10 +116,10 @@ func (m *model) GetAllUsers() []User {
func (m *model) GetUserByName(nm string) (*User, error) {
var err error
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return nil, err
}
defer m.closeDB()
defer m.bolt.CloseDB()
usrids := m.GetUserIdList()
for i := range usrids {
bkt := []string{"users", usrids[i]}
@ -180,58 +135,11 @@ func (m *model) GetUserByName(nm string) (*User, error) {
func (m *model) GetUserIdList() []string {
var ret []string
var err error
if err = m.openDB(); err != nil {
if err = m.bolt.OpenDB(); err != nil {
return ret
}
defer m.closeDB()
defer m.bolt.CloseDB()
bkt := []string{"users"}
ret, _ = m.bolt.GetBucketList(bkt)
return ret
}
// updateUserPassword
// Takes a user id and a password
// Fails if the user doesn't exist
func (m *model) updateUserPassword(uid, password string) error {
cryptPw, cryptError := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if cryptError != nil {
return cryptError
}
if _, err := m.GetUser(uid); err != nil {
return err
}
if err := m.openDB(); err != nil {
return err
}
defer m.closeDB()
usrPath := []string{"users", uid}
return m.bolt.SetValue(usrPath, "password", string(cryptPw))
}
// Is the uid and pw given valid?
func (m *model) checkCredentials(uid, pw string) error {
var err error
if err = m.openDB(); err != nil {
return err
}
defer m.closeDB()
var uPw string
usrPath := []string{"users", uid}
if uPw, err = m.bolt.GetValue(usrPath, "password"); err != nil {
return err
}
return bcrypt.CompareHashAndPassword([]byte(uPw), []byte(pw))
}
func (m *model) hasAdminUser() bool {
users := m.GetAllUsers()
for i := range users {
if users[i].IsAdmin {
return true
}
}
return false
}

View File

@ -1,48 +0,0 @@
package main
import (
"fmt"
)
// pageData is stuff that changes per request
type pageData struct {
Site *SiteData
Title string
SubTitle string
Stylesheets []string
HeaderScripts []string
Scripts []string
FlashMessage string
FlashClass string
LoggedIn bool
IsAdmin bool
Menu []menuItem
BottomMenu []menuItem
session *pageSession
TemplateData interface{}
}
func (p *pageData) show(tmplName string) error {
for _, tmpl := range []string{
"htmlheader.html",
"header.html",
tmplName,
"footer.html",
"htmlfooter.html",
} {
if err := outputTemplate(tmpl, p, p.session.w); err != nil {
fmt.Printf("%s\n", err)
return err
}
}
return nil
}
func (p *pageData) showRss() error {
if err := outputTemplate("rss_feed.xml", p, p.session.w); err != nil {
fmt.Printf("%s\n", err)
return err
}
return nil
}

View File

@ -1,7 +1,6 @@
package main
import (
"errors"
"fmt"
"net/http"
@ -17,9 +16,6 @@ type pageSession struct {
}
func (p *pageSession) getStringValue(key string) (string, error) {
if p.session == nil {
return "", errors.New("Session is nil")
}
val := p.session.Values[key]
var retVal string
var ok bool

View File

@ -1,62 +0,0 @@
package main
import (
"C"
"errors"
"fmt"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
)
func GetSourceName() string {
return "dilbert"
}
func GetFeedList() []map[string]string {
var ret []map[string]string
feedMap := make(map[string]string)
feedMap["slug"] = "dilbert"
feedMap["name"] = "Dilbert"
feedMap["author"] = "Scott Adams"
feedMap["source"] = GetSourceName()
ret = append(ret, feedMap)
return ret
}
func GetFeedUrl(slug string, date time.Time) (string, error) {
return fmt.Sprintf(
"http://dilbert.com/strip/%4d-%02d-%02d",
date.Year(),
date.Month(),
date.Day(),
), nil
}
func GetFeedDesc(slug string, date time.Time) (string, error) {
url, err := GetFeedUrl(slug, date)
if err != nil {
return "", err
}
res, err := http.Get(url)
if err != nil {
return "", err
}
defer res.Body.Close()
if res.StatusCode != 200 {
return "", errors.New(fmt.Sprintf("Status code error: %d %s", res.StatusCode, res.Status))
}
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return "", err
}
// Find the Picture
src, exists := doc.Find("img.img-comic").Attr("src")
if !exists {
return "", errors.New("Couldn't find image source")
}
return "<img src=\"https:" + src + "\" />", nil
}

View File

@ -1,100 +0,0 @@
package main
import (
"C"
"errors"
"fmt"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
)
func GetSourceName() string {
return "xkcd"
}
func GetFeedList() []map[string]string {
var ret []map[string]string
feedMap := make(map[string]string)
feedMap["slug"] = "xkcd"
feedMap["name"] = "XKCD"
feedMap["author"] = "Randall Munroe"
feedMap["source"] = GetSourceName()
ret = append(ret, feedMap)
return ret
}
/*
func getRssItem(slug string) (string, error) {
desc, err := getFeedDesc(time.Now())
if err != nil {
return "", err
}
feed, err := m.GetFeed(SRC_XKCD, slug)
if err != nil {
return "", err
}
desc = "<![CDATA[" + desc + "]]>"
ret := " <item>\n"
ret += " <title>" + feed.Name + "</title>\n"
ret += " <pubDate>" + feed.LastUpdate.Format(time.RFC1123Z) + "</pubDate>\n"
ret += " <guid>xkcd;" + slug + ";" + feed.LastUpdate.Format(time.RFC1123Z) + "</guid>\n"
ret += " <link>" + getUrl(time.Now()) + "</link>\n"
ret += " <description>" + desc + "</description>\n"
ret += " </item>\n"
return ret, nil
}
*/
func GetFeedUrl(slug string, dt time.Time) (string, error) {
var isComicDay = func(dt time.Time) bool {
return dt.Weekday() == time.Monday || dt.Weekday() == time.Wednesday || dt.Weekday() == time.Friday
}
if !isComicDay(dt) {
return "", errors.New("No URL for the given day")
}
var num int
wrkDate := time.Date(2005, time.August, 19, 0, 0, 0, 0, time.UTC)
for wrkDate.Before(dt) {
if isComicDay(wrkDate) {
num++
}
wrkDate = wrkDate.Add(time.Hour * 24)
}
return fmt.Sprintf("https://xkcd.com/%d", num), nil
}
func GetFeedDesc(slug string, dt time.Time) (string, error) {
var url string
var err error
if url, err = GetFeedUrl(slug, dt); err != nil {
return "", err
}
res, err := http.Get(url)
if err != nil {
return "", err
}
defer res.Body.Close()
if res.StatusCode != 200 {
return "", errors.New(fmt.Sprintf("Status code error: %d %s", res.StatusCode, res.Status))
}
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
return "", err
}
// Find the Picture
sel := doc.Find("div#comic>img")
src, exists := sel.Attr("src")
if !exists {
return "", errors.New("Couldn't find image source")
}
src = "https:" + src
title, exists := sel.Attr("title")
if !exists {
title = ""
}
return "<img src=\"" + src + "\" /><p>" + title + "</p>", nil
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +0,0 @@
</div>
<div id="modal-overlay">
<div>
<h1 id="modal-title"></h1>
<h2 id="modal-subtitle"></h2>
<div id="modal-body"></div>
<div id="modal-buttons">
</div>
<div class="reset-pull"></div>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="flash center {{.FlashClass}}">
{{.FlashMessage}}
</div>
<div class="content center-all">
{{ if .SubTitle }}
<div class="header-menu">
<h2>{{.SubTitle}}</h2>
</div>
{{ end }}

View File

@ -1,6 +0,0 @@
</div>
{{ range $i, $v := .Scripts }}
<script src="{{ $v }}"></script>
{{ end }}
</body>
</html>

View File

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta http-equiv="Cache-control" content="No-Cache">
<link rel="apple-touch-icon" href="/assets/img/favicon.png" type="image/png">
<link rel="shortcut icon" href="/assets/img/favicon.png" type="image/png">
<title>{{.Site.Title}} - {{.SubTitle}}</title>
<!--[if lt IE 9]>
<script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<![endif]-->
{{ range $i, $v := .Stylesheets }}
<link rel="stylesheet" href="{{ $v }}">
{{ end }}
{{ range $i, $v := .HeaderScripts }}
<script src="{{ $v }}"></script>
{{ end }}
</head>
<body>
<div id="layout">

View File

@ -1,22 +0,0 @@
<div class="half center-all">
<form class="pure-form pure-form-aligned" action="/user/login" method="POST">
<fieldset>
<div class="pure-control-group">
<label for="email">Email Address</label>
<input id="email" name="email" type="text" placeholder="Email Address" autofocus>
</div>
<div class="pure-control-group">
<label for="password">Password</label>
<input id="password" name="password" type="password" placeholder="Password">
</div>
<div class="pure-controls">
<label for="remember" class="pure-checkbox">
<input id="remember" name="remember" type="checkbox"> Remember Me
</label>
</div>
<button type="submit" class="pure-button pure-button-primary">Submit</button>
</fieldset>
</form>
</div>

View File

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Ribbit Feed</title>
<link>http://ribbit.bullercodeworks.com/edit/{{.TemplateData.User.Uuid}}</link>
<description>Feed for {{.TemplateData.User.Username}}</description>
<language>en-us</language>
<lastBuildDate>{{.TemplateData.BuildDate}}</lastBuildDate>
<ttl>40</ttl>
{{ range $i, $v := .TemplateData.Feeds }}
<item>
<title>{{$v.Name}}</title>
<pubDate>{{$v.LastUpdate}}</pubDate>
<guid>{{$v.Source}};{{$v.Slug}};{{$v.LastUpdate}}</guid>
<link></link>
<description><![CDATA[{{$v.Desc}}]]></description>
</item>
{{ end }}
</channel>
</rss>

View File

@ -1,3 +0,0 @@
<a href="/user/feeds">Edit Subscriptions</a>
<a href="/rss/{{.TemplateData.Uuid}}">RSS Feed</a>

View File

@ -1,135 +0,0 @@
<div id="all_sources_container"></div>
<form name="feed_subscriptions" action="/user/updatesubscriptions" onsubmit="updateSubscriptionValue()">
<input id="user_feeds" type="hidden" name="user_feeds" value="" />
<button type="submit">Save</button>
</form>
<script>
var user_feeds = [
{{ range $i, $v := .TemplateData.User.SubSlugs }}
"{{$v}}",
{{ end }}
];
var all_feeds = [
{{ range $i, $v := .TemplateData.FeedSources }}
{{ range $vi, $vf := $v.Feeds }}
{
"name": "{{$vf.Name}}",
"author": "{{$vf.Author}}",
"slug": "{{$vf.Slug}}",
"source": "{{$vf.Source}}",
"desc": "{{$vf.Desc}}",
"last_update": "{{$vf.LastUpdate}}"
},
{{ end }}
{{ end }}
];
function init() {
var sourcesContainer = document.getElementById("all_sources_container");
var sources = [];
for(var i = 0; i < all_feeds.length; i++) {
if(sources.indexOf(all_feeds[i].source) < 0) {
sources.push(all_feeds[i].source)
}
}
for(var i = 0; i < sources.length; i++) {
sourcesContainer.appendChild(createFeedSourceTable(sources[i]));
}
}
function createFeedSourceTable(source) {
var sourceContainer = document.createElement("div");
var sourceTitle = document.createElement("h1");
sourceTitle.innerText = source+" ";
sourceContainer.appendChild(sourceTitle);
var table = document.createElement("table");
table.classList.add("pure-table","pure-table-bordered","center-all","hidden");
var thead = document.createElement("thead");
var thtr = document.createElement("tr");
var thChk = document.createElement("th");
var thn = document.createElement("th");
thn.innerText = "Name";
var tha = document.createElement("th");
tha.innerText = "Author";
var thl = document.createElement("th");
thl.innerText = "Last Update";
thtr.appendChild(document.createElement("th"));
for(var i = 0; i < all_feeds.length; i++) {
if(all_feeds[i].source == source) {
table.appendChild(createFeedTableRow(all_feeds[i]));
}
}
sourceContainer.appendChild(table);
var sourceShow = document.createElement("a");
sourceShow.style["color"] = "blue";
sourceShow.style["cursor"] = "pointer";
sourceShow.innerText = "v";
sourceShow.onclick = function() {
if(table.classList.contains("hidden")) {
sourceShow.innerText = "^";
} else {
sourceShow.innerText = "v";
}
table.classList.toggle("hidden");
}
sourceTitle.appendChild(sourceShow);
sourceContainer.style["margin-bottom"] = "2em";
return sourceContainer;
}
function createFeedTableRow(feedItem) {
var row = document.createElement("tr");
var chkCell = document.createElement("td");
var chkBox = document.createElement("input");
chkBox.setAttribute("type", "checkbox");
chkBox.setAttribute("data-slug", feedItem["source"]+";"+feedItem["slug"]);
chkBox.onclick = function() {
toggleSubscription(this.getAttribute("data-slug"));
}
if(user_feeds.indexOf(feedItem["source"]+";"+feedItem["slug"]) >= 0) {
chkBox.checked = true;
}
chkCell.append(chkBox);
row.append(chkCell);
var nameCell = document.createElement("td");
nameCell.innerText = feedItem["name"];
row.append(nameCell);
var authCell = document.createElement("td");
authCell.innerText = feedItem["author"];
row.append(authCell);
var updCell = document.createElement("td");
updCell.innerText = feedItem["last_update"];
row.append(updCell);
return row;
}
function toggleSubscription(slug) {
if(user_feeds.indexOf(slug) >= 0) {
user_feeds.splice(user_feeds.indexOf(slug), 1);
} else {
user_feeds.push(slug);
}
updateSubscriptionValue();
}
function getSubRow(slug) {
return document.getElementById("row_"+slug.replace(";","_"));
}
function updateSubscriptionTable() {
for(var i = 0; i < user_feeds.length; i++) {
var row = getSubRow(user_feeds[i]);
if(row) {
row.getElementsByTagName("input")[0].checked = true;
}
}
}
function updateSubscriptionValue() {
document.getElementById("user_feeds").value = user_feeds;
}
init();
updateSubscriptionTable();
</script>