diff --git a/.github/workflows/binary-release.yml b/.github/workflows/binary-release.yml deleted file mode 100644 index 79666a6..0000000 --- a/.github/workflows/binary-release.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Binary-release - -on: - workflow_dispatch: - release: - types: [created] - -jobs: - generate: - name: Create release-artifacts - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@master - - - uses: actions/setup-go@v4 - with: - go-version: 'stable' - - run: go version - - - uses: goreleaser/goreleaser-action@v5 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.version b/.version new file mode 100644 index 0000000..bbbc642 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +VERSION=0.1.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f98e90e..72cba79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [0.1.1] - 2023-12-23 +### Added +- Local JS and Themes +- Weight chart ## [0.1.0] - 2023-12-23 ### Added diff --git a/Makefile b/Makefile index bc752c5..d802157 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ mod: run: cd cmd/$(PKG_NAME)/ && \ - go run . -n "http://192.168.2.3:8850" + go run . fmt: go fmt ./... diff --git a/README.md b/README.md index 9deffca..ddcf396 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Light and easy workout diary - [Quick start](https://github.com/aceberg/exercisediary#quick-start) - [Config](https://github.com/aceberg/exercisediary#config) - [Options](https://github.com/aceberg/exercisediary#options) +- [Local network only](https://github.com/aceberg/exercisediary#local-network-only) - [Roadmap](https://github.com/aceberg/exercisediary#roadmap) - [Thanks](https://github.com/aceberg/exercisediary#thanks) @@ -48,7 +49,24 @@ Configuration can be done through config file or environment variables | Key | Description | Default | | -------- | ----------- | ------- | -| -c | Path to config dir | /data/ExerciseDiary | +| -d | Path to config dir | /data/ExerciseDiary | +| -n | Path to local JS and Themes ([node-bootstrap](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap)) | "" | + +## Local network only +By default, this app pulls themes, icons and fonts from the internet. But, in some cases, it may be useful to have an independent from global network setup. I created a separate [image](https://github.com/aceberg/my-dockerfiles/tree/main/node-bootstrap) with all necessary modules and fonts. +```sh +docker run --name node-bootstrap \ + -v ~/.dockerdata/icons:/app/icons \ # For local images + -p 8850:8850 \ + aceberg/node-bootstrap +``` +```sh +docker run --name exdiary \ + -v ~/.dockerdata/ExerciseDiary:/data/ExerciseDiary \ + -p 8849:8849 \ + aceberg/exercisediary -n "http://$YOUR_IP:8850" +``` +Or use [docker-compose](docker-compose-local.yml) ## Roadmap - [x] HeatMap diff --git a/build/ci/build-deb.sh b/build/ci/build-deb.sh deleted file mode 100755 index caa2f85..0000000 --- a/build/ci/build-deb.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -PKGNAME=ExerciseDiary -PKGDESC="Write app description here" -PKGDIR=$PKGNAME-$1-0_all - -umask 0022 - -mkdir -p $PKGDIR/usr/bin -mkdir -p $PKGDIR/lib/systemd/system - -cp configs/$PKGNAME.service $PKGDIR/lib/systemd/system/ -cp configs/$PKGNAME@.service $PKGDIR/lib/systemd/system/ - -cp $PKGNAME $PKGDIR/usr/bin/ - -mkdir -p $PKGDIR/DEBIAN - -echo "Package: $PKGNAME -Version: $1 -Section: utils -Priority: optional -Architecture: all -Maintainer: aceberg -Description: $PKGDESC -" > $PKGDIR/DEBIAN/control - -echo " -systemctl daemon-reload -" > $PKGDIR/DEBIAN/postinst - -chmod 775 $PKGDIR/DEBIAN/postinst - -dpkg-deb --build --root-owner-group $PKGDIR - -rm -rf $PKGDIR \ No newline at end of file diff --git a/build/ci/build.sh b/build/ci/build.sh deleted file mode 100755 index 1e9ed4e..0000000 --- a/build/ci/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -PKGNAME=ExerciseDiary -PKGDIR=/opt/$PKGNAME - -cd cmd/$PKGNAME/ && CGO_ENABLED=0 go build -o ../../$PKGNAME . -cd ../../ - -umask 0022 - -mkdir -p $PKGDIR -cp $PKGNAME $PKGDIR/ -cp configs/$PKGNAME.service $PKGDIR/ -cp configs/$PKGNAME@.service $PKGDIR/ -cp configs/install.sh $PKGDIR/ - -cd /opt -tar cvzf $PKGNAME-$1.tar.gz $PKGNAME -cd - -cp /opt/$PKGNAME-$1.tar.gz . \ No newline at end of file diff --git a/configs/AppTemplate.service b/configs/AppTemplate.service deleted file mode 100644 index f1df432..0000000 --- a/configs/AppTemplate.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=ExerciseDiary -Documentation=https://github.com/aceberg/ExerciseDiary -After=network-online.target -Wants=network-online.target - -[Service] -ExecStart=/usr/bin/ExerciseDiary -c /etc/ExerciseDiary/config.yaml -Restart=on-failure - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/configs/AppTemplate@.service b/configs/AppTemplate@.service deleted file mode 100644 index 0f866fc..0000000 --- a/configs/AppTemplate@.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=ExerciseDiary -Documentation=https://github.com/aceberg/ExerciseDiary -After=network-online.target -Wants=network-online.target - -[Service] -User=%i -ExecStart=/usr/bin/ExerciseDiary -c /home/%i/.config/ExerciseDiary/config.yaml -Restart=on-failure - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/configs/install.sh b/configs/install.sh deleted file mode 100755 index 456f54b..0000000 --- a/configs/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -PKGNAME=ExerciseDiary - -cp $PKGNAME /usr/bin/ -cp $PKGNAME.service /lib/systemd/system/ -cp $PKGNAME@.service /lib/systemd/system/ \ No newline at end of file diff --git a/docker-compose-local.yml b/docker-compose-local.yml new file mode 100644 index 0000000..e26439f --- /dev/null +++ b/docker-compose-local.yml @@ -0,0 +1,25 @@ +version: "3" +services: + node-bootstrap: + image: aceberg/node-bootstrap + restart: unless-stopped + ports: + - 8850:8850 + volumes: + - ~/.dockerdata/icons:/app/icons # For local icons + exdiary: + image: aceberg/exercisediary + restart: unless-stopped + ports: + - 8851:8851 + command: "-n http://YOUR_IP:8850" # Put your server IP or DNS name here + depends_on: + - node-bootstrap + volumes: + - ~/.dockerdata/ExerciseDiary:/data/ExerciseDiary # app data (set your own path instead of dockerdata) + environment: + TZ: Asia/Novosibirsk # required for uptime monitor, default "" + HOST: "0.0.0.0" # optional, default: 0.0.0.0 + PORT: "8851" # optional, default: 8851 + THEME: "grass" # optional, default: grass + COLOR: "light" # optional, default: light \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8ec22e8..cbe0f86 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,10 @@ version: "3" services: - ExerciseDiary: + exdiary: image: aceberg/exercisediary restart: unless-stopped + ports: + - 8851:8851 volumes: - ~/.dockerdata/ExerciseDiary:/data/ExerciseDiary environment: diff --git a/internal/web/public/js/heatmap.js b/internal/web/public/js/heatmap.js index faa176f..bbf3ffb 100644 --- a/internal/web/public/js/heatmap.js +++ b/internal/web/public/js/heatmap.js @@ -50,7 +50,7 @@ function makeChart(heat, hcolor, sets) { const res = window.myMatrix.getElementsAtEventForMode(e, 'nearest', { intersect: true }, true); let clickDate = res[0].element.$context.raw.d; // console.log('CLICK DATE =', clickDate); - + setFormContent(sets, clickDate); // index.js }, plugins: { diff --git a/internal/web/public/js/index.js b/internal/web/public/js/index.js index 3d725b3..0dc4381 100644 --- a/internal/web/public/js/index.js +++ b/internal/web/public/js/index.js @@ -16,10 +16,12 @@ function setFormContent(sets, date) { document.getElementById("formDate").value = date; document.getElementById("realDate").value = date; - let len = sets.length; - for (let i = 0 ; i < len; i++) { - if (sets[i].Date == date) { - addExercise(sets[i].Name, sets[i].Weight, sets[i].Reps); + if (sets) { + let len = sets.length; + for (let i = 0 ; i < len; i++) { + if (sets[i].Date == date) { + addExercise(sets[i].Name, sets[i].Weight, sets[i].Reps); + } } } }; @@ -37,6 +39,11 @@ function setFormDate(sets) { setFormContent(sets, today); }; +function setWeightDate() { + let date = document.getElementById("realDate").value; + document.getElementById("weightDate").value = date; +}; + function delExercise(exID) { document.getElementById(exID).remove(); diff --git a/internal/web/public/js/weight.js b/internal/web/public/js/weight.js index 4c20b0b..09b949b 100644 --- a/internal/web/public/js/weight.js +++ b/internal/web/public/js/weight.js @@ -16,6 +16,7 @@ function splitWeight(weight) { function weightChart(weight, wcolor) { + if (weight) { splitWeight(weight); // console.log('FDATA =', dates, ws); @@ -49,5 +50,5 @@ function weightChart(weight, wcolor) { } } }); - + } }; \ No newline at end of file diff --git a/internal/web/templates/index.html b/internal/web/templates/index.html index cece7c5..f7ef1f2 100644 --- a/internal/web/templates/index.html +++ b/internal/web/templates/index.html @@ -21,7 +21,7 @@ - + @@ -46,13 +46,13 @@
- +
- +
-
@@ -77,7 +77,7 @@

{{ range $.ExData.Exs }} {{ if eq .Group $gr }}
- @@ -107,6 +107,7 @@

+
Date
Weight