From 64c0446453df40bce06a492e4575dc64df627c89 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 12:52:20 +0000 Subject: [PATCH 1/8] Update project to go mod, proper Docker support, CI. --- .dockerignore | 4 + .github/workflows/dev-docker-build-push.yml | 28 +++++++ .github/workflows/docker-build-push.yml | 28 +++++++ .gitignore | 2 + Dockerfile | 43 +++++------ Godeps/Godeps.json | 51 ------------- Godeps/Readme | 5 -- assets/config/config.json | 9 +-- assets/web/admin.html | 26 +------ assets/web/index.html | 82 +-------------------- 10 files changed, 83 insertions(+), 195 deletions(-) create mode 100644 .github/workflows/dev-docker-build-push.yml create mode 100644 .github/workflows/docker-build-push.yml delete mode 100644 Godeps/Godeps.json delete mode 100644 Godeps/Readme diff --git a/.dockerignore b/.dockerignore index a3b6b46..5210f77 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,3 +22,7 @@ feed\.rss .travis\.yml _config\.yml + +Dockerfile + +assets/ diff --git a/.github/workflows/dev-docker-build-push.yml b/.github/workflows/dev-docker-build-push.yml new file mode 100644 index 0000000..dc6ae8c --- /dev/null +++ b/.github/workflows/dev-docker-build-push.yml @@ -0,0 +1,28 @@ +name: push gmemstr/pogo:dev + +on: + push: + paths: + - '**.go' + branches-ignore: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: gmemstr + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ghcr.io/gmemstr/pogo:dev diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 0000000..bee1e33 --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,28 @@ +name: push gmemstr/pogo:stable + +on: + push: + paths: + - '**.go' + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: gmemstr + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ghcr.io/gmemstr/pogo:stable diff --git a/.gitignore b/.gitignore index 5e8318f..c14f009 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ assets/config/users\.db run\.lockfile \.lock + +assets/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8e93505..b159f90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,21 @@ -# Use latest golang image -FROM golang:latest - -RUN mkdir -p /go/src \ - && mkdir -p /go/bin \ - && mkdir -p /go/pkg -ENV GOPATH=/go -ENV PATH=$GOPATH/bin:$PATH - -# Set working directory -WORKDIR $GOPATH/src/github.com/gmemstr/pogo - -# Add source to container so we can build -ADD . $GOPATH/src/github.com/gmemstr/pogo - -# 1. Install make and dependencies -# 2. Install Go dependencies -# 3. Build named Linux binary and allow execution -# 4. List directory structure (for debugging really)\ -# 5. Make empty podcast direcory -# 6. Create empty feed files -RUN go get github.com/tools/godep && \ - godep restore && \ - go build -o pogoapp && chmod +x pogoapp +FROM golang:stretch as builder +WORKDIR /build/pogo +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . + +RUN GOOS=linux go build -ldflags "-s -w" + + +FROM debian:stretch-slim + +RUN apt update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* + +WORKDIR /app EXPOSE 3000 -CMD ./pogoapp +COPY --from=builder /build/pogo/pogo pogo + +ENTRYPOINT ["/app/pogo"] diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 1428fae..0000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "ImportPath": "github.com/gmemstr/pogo", - "GoVersion": "go1.8", - "GodepVersion": "v79", - "Deps": [ - { - "ImportPath": "github.com/fsnotify/fsnotify", - "Comment": "v1.4.2-6-g4da3e2c", - "Rev": "4da3e2cfbabc9f751898f250b49f2439785783a1" - }, - { - "ImportPath": "github.com/google/go-github/github", - "Rev": "fbfee053c26dab3772adfc7799d995eed379133e" - }, - { - "ImportPath": "github.com/google/go-querystring/query", - "Rev": "53e6ce116135b80d037921a7fdd5138cf32d7a8a" - }, - { - "ImportPath": "github.com/gorilla/feeds", - "Comment": "v1.0.0", - "Rev": "4b936b5221c53c99fcd4b15ac0b8c38ff490ab89" - }, - { - "ImportPath": "github.com/gorilla/mux", - "Comment": "v1.4.0-10-g18fca31", - "Rev": "18fca31550181693b3a834a15b74b564b3605876" - }, - { - "ImportPath": "github.com/mattn/go-sqlite3", - "Comment": "v1.3.0", - "Rev": "5160b48509cf5c877bc22c11c373f8c7738cdb38" - }, - { - "ImportPath": "golang.org/x/crypto/bcrypt", - "Rev": "9419663f5a44be8b34ca85f08abc5fe1be11f8a3" - }, - { - "ImportPath": "golang.org/x/crypto/blowfish", - "Rev": "9419663f5a44be8b34ca85f08abc5fe1be11f8a3" - }, - { - "ImportPath": "golang.org/x/net/context", - "Rev": "3da985ce5951d99de868be4385f21ea6c2b22f24" - }, - { - "ImportPath": "golang.org/x/sys/unix", - "Rev": "0b25a408a50076fbbcae6b7ac0ea5fbb0b085e79" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/assets/config/config.json b/assets/config/config.json index d367062..820b6b9 100644 --- a/assets/config/config.json +++ b/assets/config/config.json @@ -1,8 +1 @@ -{ - "Name": "Pogo Test Feed", - "Host": "Gabriel Simmer", - "Email": "admin@localhost", - "Description": "Discussion about open source projects on the internet.", - "Image": "localhost:3000/assets/logo-xs.png", - "PodcastUrl": "http://localhost:3000" -} \ No newline at end of file +{"Name":"Pogo Podcast","Host":"John Doe","Email":"johndoe@localhost","Description":"A Podcast About Stuff","Image":"localhost:3000/assets/podcastimage.png","PodcastUrl":"http://localhost:3000"} \ No newline at end of file diff --git a/assets/web/admin.html b/assets/web/admin.html index 932e768..14f1187 100644 --- a/assets/web/admin.html +++ b/assets/web/admin.html @@ -1,25 +1 @@ - - - - - Pogo Publish - - - - -
-
- -

{{ header }}

- -
-
- - - - - - \ No newline at end of file +Pogo LAUNCHPAD (Admin)
\ No newline at end of file diff --git a/assets/web/index.html b/assets/web/index.html index 8a913c1..14ec1c9 100644 --- a/assets/web/index.html +++ b/assets/web/index.html @@ -1,81 +1 @@ - - - - - Pogo Loading - - - - - - - - -
-
-

Loading

-

Admin

- -
- -
-
-
-

Pogo licensed under the GPLv3 | RSS Feed -

-
- - - \ No newline at end of file +Pogo (Loading)
\ No newline at end of file From 22eb792f905b00889776fd64cfde5a056052b470 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 12:53:03 +0000 Subject: [PATCH 2/8] remove travisci config. --- .travis.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 04de097..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: go -sudo: false -services: - - docker -matrix: - include: - - go: 1.8 - - go: 1.9 - - go: 1.x - - go: master - allow_failures: - - go: master - - before_install: - - go get github.com/tools/godep - - install: - - godep restore - - script: - - go vet . - - go test - - go build - - ls -al - -script: - - docker build -t gmemstr/pogo . - - docker run -d --rm --name pogo -p 3000:3000 gmemstr/pogo - - sleep 10 - - docker ps | grep gmemstr/pogo - -after_success: - - if [ "$TRAVIS_BRANCH" == "master" ]; then - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; - docker push gmemstr/pogo; - fi \ No newline at end of file From f09fa7dc18ea4a7086953071903167d087405505 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 12:59:56 +0000 Subject: [PATCH 3/8] Tweaks to setup, actions. --- .github/workflows/dev-docker-build-push.yml | 3 +++ .github/workflows/docker-build-push.yml | 3 +++ go.mod | 17 +++++++++++++ go.sum | 27 +++++++++++++++++++++ setup.go | 8 +++--- 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/workflows/dev-docker-build-push.yml b/.github/workflows/dev-docker-build-push.yml index dc6ae8c..b4d0470 100644 --- a/.github/workflows/dev-docker-build-push.yml +++ b/.github/workflows/dev-docker-build-push.yml @@ -4,6 +4,9 @@ on: push: paths: - '**.go' + - 'go.mod' + - 'go.sum' + - '.github/workflows/dev-docker-build-push.yml' branches-ignore: - 'master' diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index bee1e33..c47e63f 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -4,6 +4,9 @@ on: push: paths: - '**.go' + - 'go.mod' + - 'go.sum' + - '.github/workflows/docker-build-push.yml' branches: - 'master' diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b259822 --- /dev/null +++ b/go.mod @@ -0,0 +1,17 @@ +module github.com/gmemstr/pogo + +go 1.17 + +require ( + github.com/fsnotify/fsnotify v1.5.1 + github.com/google/go-github v17.0.0+incompatible + github.com/gorilla/feeds v1.0.0 + github.com/gorilla/mux v1.8.0 + github.com/mattn/go-sqlite3 v1.14.12 + golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd +) + +require ( + github.com/google/go-querystring v1.1.0 // indirect + golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..4e19524 --- /dev/null +++ b/go.sum @@ -0,0 +1,27 @@ +github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= +github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/gorilla/feeds v1.0.0 h1:EbkEvaYf+PXhYNHS20heBG7Rl2X6Zy8l11ZBWAHkWqE= +github.com/gorilla/feeds v1.0.0/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0= +github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38= +golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf h1:Fm4IcnUL803i92qDlmB0obyHmosDrxZWxJL3gIeNqOw= +golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/setup.go b/setup.go index db1ec62..e6b9638 100644 --- a/setup.go +++ b/setup.go @@ -63,24 +63,24 @@ func GetWebAssets() { for i := 0; i < len(res.Assets); i++ { if res.Assets[i].GetName() == "webassets.zip" { download := res.Assets[i] - fmt.Println("Release found: %v", download.GetBrowserDownloadURL()) + fmt.Printf("Release found: %v\n", download.GetBrowserDownloadURL()) tmpfile, err := os.Create(download.GetName()) if err != nil { - fmt.Println("Problem creating webassets file! %v", err) + fmt.Printf("Problem creating webassets file! %v\n", err) } var j io.Reader = (*os.File)(tmpfile) defer tmpfile.Close() j, s, err := client.DownloadReleaseAsset(ctx, "gmemstr", "pogo-vue", download.GetID()) if err != nil { - fmt.Println("Problem downloading webassets! %v", err) + fmt.Printf("Problem downloading webassets! %v\n", err) } if j == nil { resp, err := http.Get(s) defer resp.Body.Close() _, err = io.Copy(tmpfile, resp.Body) if err != nil { - fmt.Println("Problem creating webassets file! %v", err) + fmt.Printf("Problem creating webassets file! %v\n", err) } fmt.Println("Download complete\nUnzipping") err = Unzip(download.GetName(), "assets/web") From 1d683296f0285e5a35930d0c16a836ef5cb3aeae Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 13:18:23 +0000 Subject: [PATCH 4/8] Move lockfile to assets dir. --- setup.go | 2 +- webserver.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.go b/setup.go index e6b9638..8912d09 100644 --- a/setup.go +++ b/setup.go @@ -126,7 +126,7 @@ func CreateDatabase() { } func LockFile() { - lock, err := os.Create(".lock") + lock, err := os.Create("./assets/.lock") if err != nil { fmt.Println("Error: %v", err) } diff --git a/webserver.go b/webserver.go index 81a3315..800e87b 100644 --- a/webserver.go +++ b/webserver.go @@ -20,7 +20,7 @@ func main() { // Check if this is the first time Pogo has been run // with a lockfile - if _, err := os.Stat(".lock"); os.IsNotExist(err) { + if _, err := os.Stat("./assets/.lock"); os.IsNotExist(err) { fmt.Println("This looks like your first time running Pogo, give me a second to set myself up.") Setup() } From 59a3df81d6688281e14f9e9fddc03ea4b2182825 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 13:23:56 +0000 Subject: [PATCH 5/8] Tweak first time setup check. --- setup.go | 2 +- webserver.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.go b/setup.go index 8912d09..372fe06 100644 --- a/setup.go +++ b/setup.go @@ -126,7 +126,7 @@ func CreateDatabase() { } func LockFile() { - lock, err := os.Create("./assets/.lock") + lock, err := os.Create("assets/.lock") if err != nil { fmt.Println("Error: %v", err) } diff --git a/webserver.go b/webserver.go index 800e87b..f793583 100644 --- a/webserver.go +++ b/webserver.go @@ -20,7 +20,7 @@ func main() { // Check if this is the first time Pogo has been run // with a lockfile - if _, err := os.Stat("./assets/.lock"); os.IsNotExist(err) { + if _, err := os.Stat("assets/.lock"); err != nil { fmt.Println("This looks like your first time running Pogo, give me a second to set myself up.") Setup() } From fd4cb338cc944f3f9969ce420610f83661de7519 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 13:30:42 +0000 Subject: [PATCH 6/8] Outright remove lockfile. --- setup.go | 4 ++-- webserver.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.go b/setup.go index 372fe06..afa58cb 100644 --- a/setup.go +++ b/setup.go @@ -40,7 +40,7 @@ func Setup() { go GenerateRss() // Create "first run" lockfile when function exits - defer LockFile() + // defer LockFile() // Create users SQLite3 file CreateDatabase() @@ -126,7 +126,7 @@ func CreateDatabase() { } func LockFile() { - lock, err := os.Create("assets/.lock") + lock, err := os.Create(".lock") if err != nil { fmt.Println("Error: %v", err) } diff --git a/webserver.go b/webserver.go index f793583..2d376a9 100644 --- a/webserver.go +++ b/webserver.go @@ -20,7 +20,7 @@ func main() { // Check if this is the first time Pogo has been run // with a lockfile - if _, err := os.Stat("assets/.lock"); err != nil { + if _, err := os.Stat("assets"); os.IsNotExist(err) { fmt.Println("This looks like your first time running Pogo, give me a second to set myself up.") Setup() } From 4964e4e0f42f4220859e5b90008784a096935019 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 13:33:32 +0000 Subject: [PATCH 7/8] Test pressence of config json file. --- webserver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webserver.go b/webserver.go index 2d376a9..3ad4cc6 100644 --- a/webserver.go +++ b/webserver.go @@ -20,7 +20,7 @@ func main() { // Check if this is the first time Pogo has been run // with a lockfile - if _, err := os.Stat("assets"); os.IsNotExist(err) { + if _, err := os.Stat("assets/config/config.json"); os.IsNotExist(err) { fmt.Println("This looks like your first time running Pogo, give me a second to set myself up.") Setup() } From 07969a93387f7e52ddad8a88df6877aefe7fb44c Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 13:39:17 +0000 Subject: [PATCH 8/8] Remove assets directory, race condition. --- assets/config/config.json | 1 - assets/web/README.md | 7 - assets/web/admin.html | 1 - assets/web/index.html | 1 - assets/web/login.html | 25 -- assets/web/static/app.js | 384 ------------------------------- assets/web/static/custom.css | 39 ---- assets/web/static/logo-large.png | Bin 80753 -> 0 bytes assets/web/static/logo-med.png | Bin 18341 -> 0 bytes assets/web/static/logo-sm.png | Bin 7102 -> 0 bytes assets/web/static/logo-xs.png | Bin 9600 -> 0 bytes assets/web/static/setup.css | 24 -- assets/web/static/styles.css | 120 ---------- setup.go | 2 +- 14 files changed, 1 insertion(+), 603 deletions(-) delete mode 100644 assets/config/config.json delete mode 100644 assets/web/README.md delete mode 100644 assets/web/admin.html delete mode 100644 assets/web/index.html delete mode 100644 assets/web/login.html delete mode 100644 assets/web/static/app.js delete mode 100644 assets/web/static/custom.css delete mode 100644 assets/web/static/logo-large.png delete mode 100644 assets/web/static/logo-med.png delete mode 100644 assets/web/static/logo-sm.png delete mode 100644 assets/web/static/logo-xs.png delete mode 100644 assets/web/static/setup.css delete mode 100644 assets/web/static/styles.css diff --git a/assets/config/config.json b/assets/config/config.json deleted file mode 100644 index 820b6b9..0000000 --- a/assets/config/config.json +++ /dev/null @@ -1 +0,0 @@ -{"Name":"Pogo Podcast","Host":"John Doe","Email":"johndoe@localhost","Description":"A Podcast About Stuff","Image":"localhost:3000/assets/podcastimage.png","PodcastUrl":"http://localhost:3000"} \ No newline at end of file diff --git a/assets/web/README.md b/assets/web/README.md deleted file mode 100644 index c93116f..0000000 --- a/assets/web/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# What is this?! - -This is the _development version_ (DeV) of the web interface for Pogo. - -It is not recommended you use this for your own deployment, and instead rely on the auto-setup feature of the binary. If you still insist manually deploying your own binary, please consider downloading the latest `webassets.zip` release from [gmemstr/pogo-vue](https://github.com/gmmestr/pogo-vue/releases/latest), which contains the production version of the Vue.js interface. The interface in this repository should be considered "canary" or "nightly", and for testing routes and features during development. Thanks! - -~ Gabe \ No newline at end of file diff --git a/assets/web/admin.html b/assets/web/admin.html deleted file mode 100644 index 14f1187..0000000 --- a/assets/web/admin.html +++ /dev/null @@ -1 +0,0 @@ -Pogo LAUNCHPAD (Admin)
\ No newline at end of file diff --git a/assets/web/index.html b/assets/web/index.html deleted file mode 100644 index 14ec1c9..0000000 --- a/assets/web/index.html +++ /dev/null @@ -1 +0,0 @@ -Pogo (Loading)
\ No newline at end of file diff --git a/assets/web/login.html b/assets/web/login.html deleted file mode 100644 index 14bbadf..0000000 --- a/assets/web/login.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Login to Pogo Admin Page - - - -

Login

- -
- - - - - - - - - - -
- - - \ No newline at end of file diff --git a/assets/web/static/app.js b/assets/web/static/app.js deleted file mode 100644 index 27b3bdf..0000000 --- a/assets/web/static/app.js +++ /dev/null @@ -1,384 +0,0 @@ -const episodepublishform = { - template: `
-

Publish Episode

-
- - - - - - - -

- -
-
` -} - -const message = { - template: `

{{ this.$route.params.message }}

` -} - -const userlist = { - template: `
- New - - - - - - - - - - - -
UsernameEmail
{{ item.username }}{{ item.email }} - Edit -
-
`, - data() { - return { - loading: false, - items: null, - error: null - } - }, - created() { - // fetch the data when the view is created and the data is - // already being observed - this.fetchData() - }, - watch: { - // call again the method if the route changes - '$route': 'fetchData' - }, - methods: { - fetchData() { - this.error = this.items = [] - this.loading = true - - get("/admin/listusers", (err, items) => { - this.loading = false - if (err) { - this.error = err.toString() - } else { - var t = JSON.parse(items).reverse(); - for (var i = t.length - 1; i >= 0; i--) { - this.items.push({ - id: t[i].id, - username: t[i].username, - email: t[i].email, - }) - } - } - }) - } - } -} - -const usernew = { - template: `
-
-

New User

-
- - - - - - - - - - - -

-
-
-
` -} - -const useredit = { - template: `
-
-

Edit User

-
- - - - - - - - - - - - - -

- - - -

-
- Delete User -
-
`, - data() { - return { - loading: false, - user: null, - error: null - } - }, - created() { - // fetch the data when the view is created and the data is - // already being observed - this.fetchData() - }, - watch: { - // call again the method if the route changes - '$route': 'fetchData' - }, - methods: { - fetchData() { - this.error = this.user = [] - this.loading = true - - get("/admin/listusers", (err, items) => { - this.loading = false - if (err) { - this.error = err.toString() - } else { - var t = JSON.parse(items) - for (var i = t.length - 1; i >= 0; i--) { - if (t[i].id == this.$route.params.id) { - this.user = { - id: t[i].id, - username: t[i].username, - email: t[i].email, - realname: t[i].realname - } - } - } - } - }) - } - } -} - -const episodemanagement = { - template: `
- - - - - - - - - -
TitleURL
{{ item.id }}: {{ item.title }}{{ item.url }}Edit
-
`, - data() { - return { - loading: false, - items: null, - error: null - } - }, - created() { - // fetch the data when the view is created and the data is - // already being observed - this.fetchData() - }, - watch: { - // call again the method if the route changes - '$route': 'fetchData' - }, - methods: { - fetchData() { - this.error = this.items = [] - this.loading = true - - get("/json", (err, items) => { - this.loading = false - if (err) { - this.error = err.toString() - } else { - var t = JSON.parse(items).items - for (var i = t.length - 1; i >= 0; i--) { - console.log(i) - this.items.push({ - title: t[i].title, - url: t[i].url, - id: t[i].id - }) - } - } - }) - } - } -} - -const episodeedit = { - template: `
-
-

Edit Episode

-
- - - - - - - -
-
-
`, - data() { - return { - loading: false, - episode: null, - error: null - } - }, - created() { - // fetch the data when the view is created and the data is - // already being observed - this.fetchData() - }, - watch: { - // call again the method if the route changes - '$route': 'fetchData' - }, - methods: { - fetchData() { - this.error = this.episode = {} - this.loading = true - - get("/json", (err, items) => { - this.loading = false - if (err) { - this.error = err.toString() - } else { - var t = JSON.parse(items).items - for (var i = t.length - 1; i >= 0; i--) { - if (t[i].id == this.$route.params.id) { - time = t[i].date_published.split("T") - var prev = time[0] + "_" + t[i].title - this.episode = { - title: t[i].title, - description: t[i].summary, - url: t[i].url, - id: t[i].id, - time: time[0], - previousfilename: prev - } - } - } - } - console.log(this.episode) - }) - } - } -} - -const customcss = { - template: `
-

Theme

-
- -

- -
-
`, - data() { - return { - loading: false, - css: null, - error: null - } - }, - created() { - // fetch the data when the view is created and the data is - // already being observed - this.fetchData() - }, - watch: { - // call again the method if the route changes - '$route': 'fetchData' - }, - methods: { - fetchData() { - this.error = this.css = null - this.loading = true - - get("/admin/css", (err, css) => { - this.loading = false - if (css == "{}") { - this.css = "You aren't allowed to edit this CSS!" - } else { - if (err) { - this.error = err.toString() - } else { - this.css = css - } - } - }) - } - } -} - -const routes = [ - {path: '/', redirect: '/publish'}, - { path: '/publish', component: episodepublishform }, - { path: '/manage', component: episodemanagement }, - { path: '/theme', component: customcss }, - { path: '/edit/:id', component: episodeedit }, - { path: '/users/', component: userlist }, - { path: '/msg/:message', component: message }, - { path: '/user/:id', component: useredit }, - { path: '/users/new', component: usernew } -] - -const router = new VueRouter({ - routes -}) - -const app = new Vue({ - router, - data: { - header: 'Pogo Admin', - } -}).$mount('#app') - -function get(url,callback) { - var xmlHttp = new XMLHttpRequest(); - xmlHttp.onreadystatechange = function() { - if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { - if (xmlHttp.responseText == "Unauthorized") { - callback(null, "{}") - } else { - callback(null, xmlHttp.responseText) - } - } - } - xmlHttp.open("GET", url, true); - xmlHttp.send(null); -} - -function logout() { - document.cookie = "POGO_SESSION=;expires=Thu, 01 Jan 1970 00:00:01 GMT"; - window.location = "/"; -} \ No newline at end of file diff --git a/assets/web/static/custom.css b/assets/web/static/custom.css deleted file mode 100644 index 6202346..0000000 --- a/assets/web/static/custom.css +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This is the file of custom CSS styling that - * can be set by the publisher. - * - * If you're writing the custom CSS, please see the reference: - * https://github.com/gmemstr/Pogo/wiki/Custom-CSS/ - */ - -.container {} /* Basic container from styles.css */ -.title {} /* Page title */ -.adminlink { /* Link to admin interface */ - margin-left:100%; - display:inline-block; - margin-bottom: 10px; - background-color: #397AD6; - border: none; - color: white; - padding: 5px 32px; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - -webkit-transition:.52s; - -moz-transition: .5s; - -o-transition: .5s; - -ms-transition: .5s; - transition:.5s; -} -.adminlink:hover { - background-color: #50B7D5; -} - -.podcastlist {} /* Chronological podcast list */ - -.podcastitem {} /* Single podcast item (group of elements) */ -.podcasttitle {} /* Title of podcast item */ -.podcastdate {} /* Date podcast item was published */ -.podcastdesc {} /* Podcast item description */ -.podcastaudio {} /* Podcast