upstream dev merge

this branch is broken anyway, might as well try the latest version
pull/1118/head
Willy 2023-01-31 21:28:33 +01:00
commit a02996c7ec
No known key found for this signature in database
GPG Key ID: 02E60AE5D9208602
48 changed files with 779 additions and 550 deletions

View File

@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- uses: actions/setup-node@v1
with:
node-version: 12.18.2
node-version: 16.14.0
- name: Set Version
run: |
@ -63,7 +63,7 @@ jobs:
arch: [386, amd64, arm-7, arm-6, arm64]
include:
- platform: darwin
arch: 386
arch: arm64
- platform: darwin
arch: amd64
- platform: windows
@ -92,7 +92,7 @@ jobs:
echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
- name: Set Darwin Build Flags
- name: Set MacOS (Darwin) Build Flags
if: matrix.platform == 'darwin'
run : |
echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
@ -112,7 +112,7 @@ jobs:
COMMIT: ${{ github.sha }}
with:
xgo_version: latest
go_version: 1.15.x
go_version: 1.17.x
dest: build
prefix: statping
targets: ${{ matrix.platform }}/${{ matrix.arch }}
@ -137,43 +137,22 @@ jobs:
if: matrix.platform == 'windows'
run: |
cd build
mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
mv statping-windows-${{ matrix.arch }}.exe statping.exe
chmod +x statping.exe
zip statping-windows-${{ matrix.arch }}.zip statping.exe
rm -rf statping.exe
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
- name: Compress Darwin 32bit Builds
if: matrix.platform == 'darwin' && matrix.arch == '386'
- name: Compress MacOS (Darwin) Builds
if: matrix.platform == 'darwin'
run: |
cd build
ls >> $GITHUB_ENV
# mv statping-darwin-10.6-${{ matrix.arch }} statping
# chmod +x statping
# tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz *
# rm -rf statping
# echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Compress Darwin 64bit Builds
if: matrix.platform == 'darwin' && matrix.arch == 'amd64'
run: |
cd build
mv statping-darwin-10.12-${{ matrix.arch }} statping
mv statping-darwin-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz *
rm -rf statping
echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
# - name: Compress Darwin arm64 Builds
# if: matrix.platform == 'darwin' && matrix.arch == 'arm64'
# run: |
# cd build
# mv statping-darwin-10.15-${{ matrix.arch }} statping
# chmod +x statping
# tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
# rm -rf statping
# echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Upload Compiled Statping Binary
uses: actions/upload-artifact@v1
with:
@ -207,10 +186,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- uses: actions/setup-node@v1
with:
node-version: 12.18.2
node-version: 16.14.0
- name: Install Global Dependencies
run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
@ -218,7 +197,7 @@ jobs:
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -262,7 +241,7 @@ jobs:
MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }}
PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }}
PUSHOVER_API: ${{ secrets.PUSHOVER_API }}
SLACK_URL: ${{ secrets.SLACK_URL }}
SLACK_URL: https://hooks.slack.com/services/TTJ1B90DP/RENU20O9M/9uI823SUnYBuGcxYlpSimD6H
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }}
TWILIO_SID: ${{ secrets.TWILIO_SID }}
@ -277,12 +256,12 @@ jobs:
SNS_REGION: ${{ secrets.SNS_REGION }}
SNS_TOPIC: ${{ secrets.SNS_TOPIC }}
- name: Coveralls Testing Coverage
run: |
go get github.com/mattn/goveralls
goveralls -coverprofile=coverage.out -repotoken $COVERALLS
env:
COVERALLS: ${{ secrets.COVERALLS }}
# - name: Coveralls Testing Coverage
# run: |
# go get github.com/mattn/goveralls
# goveralls -coverprofile=coverage.out -repotoken $COVERALLS
# env:
# COVERALLS: ${{ secrets.COVERALLS }}
test-postman-sqlite:
needs: frontend
@ -291,12 +270,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -345,12 +324,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -402,12 +381,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash

View File

@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- uses: actions/setup-node@v1
with:
node-version: 12.18.2
node-version: 16.14.0
- name: Set Version
run: |
@ -55,13 +55,15 @@ jobs:
path: ./source
build:
needs: [frontend, test-postman-sqlite, test-postman-mysql, test-postman-postgres]
needs: frontend
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux]
arch: [386, amd64, arm-7, arm-6, arm64]
include:
- platform: darwin
arch: arm64
- platform: darwin
arch: amd64
- platform: windows
@ -90,9 +92,10 @@ jobs:
echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
- name: Set Darwin Build Flags
- name: Set MacOS (Darwin) Build Flags
if: matrix.platform == 'darwin'
run: echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
run : |
echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
- name: Set Windows Build Flags
@ -109,12 +112,12 @@ jobs:
COMMIT: ${{ github.sha }}
with:
xgo_version: latest
go_version: 1.15.x
go_version: 1.17.x
dest: build
prefix: statping
targets: ${{ matrix.platform }}/${{ matrix.arch }}
v: false
x: false
v: true
x: true
pkg: cmd
buildmode: pie
tags: ${{ env.XGO_TAGS }}
@ -134,22 +137,22 @@ jobs:
if: matrix.platform == 'windows'
run: |
cd build
mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
mv statping-windows-${{ matrix.arch }}.exe statping.exe
chmod +x statping.exe
zip statping-windows-${{ matrix.arch }}.zip statping.exe
rm -rf statping.exe
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
- name: Compress Darwin Builds
- name: Compress MacOS (Darwin) Builds
if: matrix.platform == 'darwin'
run: |
cd build
mv statping-darwin-10.12-${{ matrix.arch }} statping
mv statping-darwin-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz *
rm -rf statping
echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Upload Compiled Statping Binary
uses: actions/upload-artifact@v1
with:
@ -168,7 +171,6 @@ jobs:
prerelease: true
files: build/${{ env.compressed }}
# test:
# needs: frontend
# runs-on: [self-hosted, linux, aboutcher-hosted]
@ -196,10 +198,10 @@ jobs:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2
# with:
# go-version: 1.15.x
# go-version: 1.17.x
# - uses: actions/setup-node@v1
# with:
# node-version: 12.18.2
# node-version: 16.14.0
# - name: Install Global Dependencies
# run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
@ -207,7 +209,7 @@ jobs:
# - name: Setting ENV's
# run: |
# echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
# echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
# echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
# echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
# shell: bash
@ -280,12 +282,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -334,12 +336,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -391,12 +393,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash

View File

@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- uses: actions/setup-node@v1
with:
node-version: 12.18.2
node-version: 16.14.0
- name: Set Version
run: |
@ -75,6 +75,8 @@ jobs:
platform: [linux]
arch: [386, amd64, arm-7, arm-6, arm64]
include:
- platform: darwin
arch: arm64
- platform: darwin
arch: amd64
- platform: windows
@ -110,7 +112,7 @@ jobs:
echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
- name: Set Darwin Build Flags
- name: Set MacOS (Darwin) Build Flags
if: matrix.platform == 'darwin'
run: echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
@ -129,7 +131,7 @@ jobs:
COMMIT: ${{ github.sha }}
with:
xgo_version: latest
go_version: 1.15.x
go_version: 1.17.x
dest: build
prefix: statping
targets: ${{ matrix.platform }}/${{ matrix.arch }}
@ -154,17 +156,17 @@ jobs:
if: matrix.platform == 'windows'
run: |
cd build
mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
mv statping-windows-${{ matrix.arch }}.exe statping.exe
chmod +x statping.exe
zip statping-windows-${{ matrix.arch }}.zip statping.exe
rm -rf statping.exe
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
- name: Compress Darwin Builds
- name: Compress MacOS (Darwin) Builds
if: matrix.platform == 'darwin'
run: |
cd build
mv statping-darwin-10.12-${{ matrix.arch }} statping
mv statping-darwin-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
rm -rf statping
@ -219,10 +221,10 @@ jobs:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2
# with:
# go-version: 1.15.x
# go-version: 1.17.x
# - uses: actions/setup-node@v1
# with:
# node-version: 12.18.2
# node-version: 16.14.0
#
# - name: Install Global Dependencies
# run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
@ -230,7 +232,7 @@ jobs:
# - name: Setting ENV's
# run: |
# echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
# echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
# echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
# echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
# shell: bash
#
@ -303,12 +305,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -357,12 +359,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -414,12 +416,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.17.x
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash

View File

@ -20,10 +20,10 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.14.2'
go-version: '1.17.8'
- uses: actions/setup-node@v1
with:
node-version: '12.18.2'
node-version: '16.14.0'
- uses: actions/checkout@v2
- name: Add GOBIN to PATH
@ -86,7 +86,7 @@ jobs:
go-version: 1.15.x
- uses: actions/setup-node@v1
with:
node-version: 12.18.2
node-version: 16.14.0
- uses: actions/checkout@v2
- name: Install Global Dependencies
@ -97,7 +97,7 @@ jobs:
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash
@ -140,7 +140,7 @@ jobs:
- name: Setting ENV's
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
echo "/opt/hostedtoolcache/node/16.14.0/x64/bin" >> $GITHUB_PATH
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
shell: bash

View File

@ -1,3 +1,14 @@
# 0.90.80 (01-26-2022)
- Fixed permissions on /app directory - Thanks twouters
# 0.90.79 (01-24-2022)
- Updated Russian Language - Thanks meatlayer
- Docker file fix for BASE_PATH and health checks - Thanks michaelkrieger
- Removed statping emailer notifier (not SMTP Mail)
- Fixes for notification failures (Issue statping#911) - Thanks glanchow
- Updated Home page uptime wording (24hr/7days) - Thanks Jonathanrbarney & thatInfrastructureGuy
- [GITHUB] Removed mailer tests
# 0.90.78 (09-15-2021)
- HTTP Webhooks accept multiple HTTP Headers
- Modified Telegram notifier to allow chat_ids

View File

@ -1,4 +1,4 @@
FROM node:12.18.2-alpine AS frontend
FROM node:16.14.0-alpine AS frontend
LABEL maintainer="Statping-ng (https://github.com/statping-ng)"
ARG BUILDPLATFORM
WORKDIR /statping
@ -10,7 +10,7 @@ RUN yarn build && yarn cache clean
# Statping Golang BACKEND building from source
# Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying
FROM golang:1.14-alpine AS backend
FROM golang:1.17-alpine AS backend
LABEL maintainer="Statping-NG (https://github.com/statping-ng)"
ARG VERSION
ARG COMMIT
@ -60,9 +60,10 @@ ENV IS_DOCKER=true
ENV SASS=/usr/local/bin/sassc
ENV STATPING_DIR=/app
ENV PORT=8080
ENV BASE_PATH=""
EXPOSE $PORT
HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD curl -s "http://localhost:$PORT/health" | jq -r -e ".online==true"
HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD if [ -z "$BASE_PATH" ]; then HEALTHPATH="/health"; else HEALTHPATH="/$BASE_PATH/health" ; fi && curl -s "http://localhost:80$HEALTHPATH" | jq -r -e ".online==true"
CMD statping --port $PORT

View File

@ -3,13 +3,13 @@ COMMIT=$(shell git rev-parse HEAD)
SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278
BINARY_NAME=statping
GOBUILD=go build -a
GOVERSION=1.14.0
NODE_VERSION=12.18.2
GOVERSION=1.17.8
NODE_VERSION=16.14.0
XGO=xgo -go $(GOVERSION) --dest=build
BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT}"
TRVIS_SECRET=O3/2KTOV8krv+yZ1EB/7D1RQRe6NdpFUEJNJkMS/ollYqmz3x2mCO7yIgIJKCKguLXZxjM6CxJcjlCrvUwibL+8BBp7xJe4XFIOrjkPvbbVPry4HkFZCf2GfcUK6o4AByQ+RYqsW2F17Fp9KLQ1rL3OT3eLTwCAGKx3tlY8y+an43zkmo5dN64V6sawx26fh6XTfww590ey+ltgQTjf8UPNup2wZmGvMo9Hwvh/bYR/47bR6PlBh6vhlKWyotKf2Fz1Bevbu0zc35pee5YlsrHR+oSF+/nNd/dOij34BhtqQikUR+zQVy9yty8SlmneVwD3yOENvlF+8roeKIXb6P6eZnSMHvelhWpAFTwDXq2N3d/FIgrQtLxsAFTI3nTHvZgs6OoTd6dA0wkhuIGLxaL3FOeztCdxP5J/CQ9GUcTvifh5ArGGwYxRxQU6rTgtebJcNtXFISP9CEUR6rwRtb6ax7h6f1SbjUGAdxt+r2LbEVEk4ZlwHvdJ2DtzJHT5DQtLrqq/CTUgJ8SJFMkrJMp/pPznKhzN4qvd8oQJXygSXX/gz92MvoX0xgpNeLsUdAn+PL9KketfR+QYosBz04d8k05E+aTqGaU7FUCHPTLwlOFvLD8Gbv0zsC/PWgSLXTBlcqLEz5PHwPVHTcVzspKj/IyYimXpCSbvu1YOIjyc=
PUBLISH_BODY='{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.14, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 10.17.0", "nvm use 10.17.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }'
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.17, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 16.14.0", "nvm use 16.14.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }'
TEST_DIR=$(GOPATH)/src/github.com/statping-ng/statping-ng
PATH:=$(GOPATH)/bin:$(PATH)
OS = freebsd linux openbsd
@ -37,16 +37,16 @@ lint:
goimports ./...
up:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans
docker compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans
make print_details
down:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans
docker compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes --remove-orphans
lite: clean
docker build -t statping-ng/statping-ng:dev -f dev/Dockerfile.dev .
docker-compose -f dev/docker-compose.lite.yml down
docker-compose -f dev/docker-compose.lite.yml up --remove-orphans
docker compose -f dev/docker-compose.lite.yml down
docker compose -f dev/docker-compose.lite.yml up --remove-orphans
reup: down clean compose-build-full up
@ -94,37 +94,37 @@ go-run:
go run ./cmd
start:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml start
docker compose -f docker-compose.yml -f dev/docker-compose.full.yml start
stop:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml stop
docker compose -f docker-compose.yml -f dev/docker-compose.full.yml stop
logs:
docker logs statping --follow
db-up:
docker-compose -f dev/docker-compose.db.yml up -d --remove-orphans
docker compose -f dev/docker-compose.db.yml up -d --remove-orphans
db-down:
docker-compose -f dev/docker-compose.db.yml down --volumes --remove-orphans
docker compose -f dev/docker-compose.db.yml down --volumes --remove-orphans
console:
docker exec -t -i statping /bin/sh
compose-build-full:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml build --parallel --build-arg VERSION=${VERSION}
compose-build-full:
docker compose -f docker-compose.yml -f dev/docker-compose.full.yml build --parallel --build-arg VERSION=${VERSION}
docker-latest:
docker-latest:
docker build -t statping-ng/statping-ng:latest --build-arg VERSION=${VERSION} .
docker-test:
docker-compose -f docker-compose.test.yml up --remove-orphans
docker compose -f docker-compose.test.yml up --remove-orphans
modd:
modd -f ./dev/modd.conf
top:
docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml top
docker compose -f docker-compose.yml -f dev/docker-compose.full.yml top
frontend-build:
@echo "Removing old frontend distributions..."
@ -382,7 +382,7 @@ delve:
check:
@echo "Checking the programs required for the build are installed..."
@echo "go: $(shell go version) - $(shell which go)" && go version >/dev/null 2>&1 || (echo "ERROR: go 1.14 is required."; exit 1)
@echo "go: $(shell go version) - $(shell which go)" && go version >/dev/null 2>&1 || (echo "ERROR: go 1.17 is required."; exit 1)
@echo "node: $(shell node --version) - $(shell which node)" && node --version >/dev/null 2>&1 || (echo "ERROR: node 12.x is required."; exit 1)
@echo "yarn: $(shell yarn --version) - $(shell which yarn)" && yarn --version >/dev/null 2>&1 || (echo "ERROR: yarn is required."; exit 1)
@echo "All required programs are installed!"

275
dev/docker-compose.full.m1.yml vendored Normal file
View File

@ -0,0 +1,275 @@
version: '2.3'
###############################################
# Statping Full Stack
#
# Statping SQLIte => http://localhost:8080
# Statping MySQL => http://localhost:8081
# Statping Postgres => http://localhost:8082
# Statping MariaDB => http://localhost:8083
#
# Adminer => http://localhost:8282
# Prometheus => http://localhost:7050
# Grafana => http://localhost:3000
#
# MySQL => http://localhost:3306
# Postgres => http://localhost:5432
# MariaDB => http://localhost:3307
#
###############################################
services:
statping_sqlite:
container_name: statping_sqlite
platform: linux/amd64
build:
context: ./
restart: on-failure
volumes:
- ./dev/docker/statping/sqlite:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: sqlite
API_SECRET: exampleapisecret
NAME: Statping
DOMAIN: http://localhost:8084
DESCRIPTION: This is a dev environment on SQLite!
ADMIN_USER: admin
ADMIN_PASSWORD: admin
SAMPLE_DATA: 'false'
ports:
- 8084:8080
networks:
- database
- frontend
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
timeout: 2s
interval: 10s
retries: 20
statping_mysql:
container_name: statping_mysql
platform: linux/amd64
build:
context: ./
restart: on-failure
volumes:
- ./dev/docker/statping/mysql:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: mysql
DB_HOST: mysql
DB_USER: root
DB_PASS: password123
DB_DATABASE: statping
DB_PORT: 3306
API_SECRET: exampleapisecret
NAME: Statping MySQL
DOMAIN: http://localhost:8081
DESCRIPTION: This is a dev environment on MySQL!
ADMIN_USER: admin
ADMIN_PASSWORD: admin
SAMPLE_DATA: 'false'
ports:
- 8081:8080
networks:
- database
- frontend
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
timeout: 2s
interval: 10s
retries: 20
depends_on:
mysql:
condition: service_healthy
statping_postgres:
container_name: statping_postgres
platform: linux/amd64
build:
context: ./
restart: on-failure
volumes:
- ./dev/docker/statping/mysql:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: postgres
DB_HOST: postgres
DB_USER: root
DB_PASS: password123
DB_DATABASE: statping
DB_PORT: 5432
API_SECRET: exampleapisecret
NAME: Statping Postgres
DOMAIN: http://localhost:8082
DESCRIPTION: This is a dev environment on Postgres!
ADMIN_USER: admin
ADMIN_PASSWORD: admin
SAMPLE_DATA: 'false'
ports:
- 8082:8080
networks:
- database
- frontend
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
timeout: 2s
interval: 10s
retries: 20
depends_on:
postgres:
condition: service_healthy
statping_mariadb:
container_name: statping_mariadb
platform: linux/amd64
build:
context: ./
restart: on-failure
volumes:
- ./dev/docker/statping/mariadb:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: mysql
DB_HOST: mariadb
DB_USER: root
DB_PASS: password123
DB_DATABASE: statping
DB_PORT: 3306
API_SECRET: exampleapisecret
NAME: Statping MariaDB
DOMAIN: http://localhost:8083
DESCRIPTION: This is a dev environment on MariaDB!
ADMIN_USER: admin
ADMIN_PASSWORD: admin
SAMPLE_DATA: 'false'
ports:
- 8083:8080
networks:
- database
- frontend
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || false"]
timeout: 2s
interval: 10s
retries: 20
depends_on:
mariadb:
condition: service_healthy
postgres:
container_name: postgres
image: postgres
volumes:
- ./dev/docker/databases/postgres:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: password123
POSTGRES_DB: statping
POSTGRES_USER: root
networks:
- database
healthcheck:
test: ["CMD-SHELL", "pg_isready -U root"]
interval: 15s
timeout: 10s
retries: 20
mysql:
container_name: mysql
image: mysql:5.7
volumes:
- ./dev/docker/databases/mysql:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password123
MYSQL_DATABASE: statping
ports:
- 3306:3306
networks:
- database
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 20s
interval: 15s
retries: 30
mariadb:
container_name: mariadb
image: mariadb
volumes:
- ./dev/docker/databases/mariadb:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password123
MYSQL_DATABASE: statping
ports:
- 3307:3306
networks:
- database
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 20s
interval: 15s
retries: 30
adminer:
container_name: adminer
image: adminer
restart: always
networks:
- database
- frontend
ports:
- 8282:8080
prometheus:
container_name: prometheus
platform: linux/amd64
image: prom/prometheus:v2.0.0
restart: on-failure
volumes:
- ./dev/prometheus.yml:/etc/prometheus/prometheus.yml
- ./dev/docker/databases/prometheus:/prometheus
ports:
- 7050:9090
networks:
- database
healthcheck:
test: "/bin/wget -q -Y off http://localhost:9090/status -O /dev/null > /dev/null 2>&1"
interval: 10s
timeout: 3s
grafana:
container_name: grafana
image: grafana/grafana
restart: on-failure
ports:
- 3000:3000
volumes:
- ./dev/docker/grafana:/var/lib/grafana
- ./dev/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
- ./dev/grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
- ./dev/grafana/statping_dashboard.json:/etc/grafana/provisioning/dashboards/statping_dashboard.json
environment:
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_ANONYMOUS_ENABLED=true
depends_on:
prometheus:
condition: service_healthy
networks:
- frontend
- database
healthcheck:
test: "/usr/bin/wget -q -Y off http://localhost:3000/api/health -O /dev/null > /dev/null 2>&1"
interval: 10s
retries: 20
networks:
frontend:
database:

View File

@ -24,11 +24,11 @@ services:
statping_sqlite:
container_name: statping_sqlite
build:
context: ../
context: ./
restart: on-failure
volumes:
- ./docker/statping/sqlite:/app
- ./services.yml:/app/services.yml
- ./dev/docker/statping/sqlite:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: sqlite
API_SECRET: exampleapisecret
@ -39,7 +39,7 @@ services:
ADMIN_PASSWORD: admin
SAMPLE_DATA: 'false'
ports:
- 8080:8080
- 8084:8080
networks:
- database
- frontend
@ -52,11 +52,11 @@ services:
statping_mysql:
container_name: statping_mysql
build:
context: ../
context: ./
restart: on-failure
volumes:
- ./docker/statping/mysql:/app
- ./services.yml:/app/services.yml
- ./dev/docker/statping/mysql:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: mysql
DB_HOST: mysql
@ -88,11 +88,11 @@ services:
statping_postgres:
container_name: statping_postgres
build:
context: ../
context: ./
restart: on-failure
volumes:
- ./docker/statping/mysql:/app
- ./services.yml:/app/services.yml
- ./dev/docker/statping/mysql:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: postgres
DB_HOST: postgres
@ -124,11 +124,11 @@ services:
statping_mariadb:
container_name: statping_mariadb
build:
context: ../
context: ./
restart: on-failure
volumes:
- ./docker/statping/mariadb:/app
- ./services.yml:/app/services.yml
- ./dev/docker/statping/mariadb:/app
- ./dev/services.yml:/app/services.yml
environment:
DB_CONN: mysql
DB_HOST: mariadb
@ -161,7 +161,7 @@ services:
container_name: postgres
image: postgres
volumes:
- ./docker/databases/postgres:/var/lib/postgresql/data
- ./dev/docker/databases/postgres:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
@ -180,7 +180,7 @@ services:
container_name: mysql
image: mysql:5.7
volumes:
- ./docker/databases/mysql:/var/lib/mysql
- ./dev/docker/databases/mysql:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password123
@ -201,7 +201,7 @@ services:
container_name: mariadb
image: mariadb
volumes:
- ./docker/databases/mariadb:/var/lib/mysql
- ./dev/docker/databases/mariadb:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password123
@ -233,8 +233,8 @@ services:
image: prom/prometheus:v2.0.0
restart: on-failure
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./docker/databases/prometheus:/prometheus
- ./dev/prometheus.yml:/etc/prometheus/prometheus.yml
- ./dev/docker/databases/prometheus:/prometheus
ports:
- 7050:9090
networks:
@ -251,10 +251,10 @@ services:
ports:
- 3000:3000
volumes:
- ./docker/grafana:/var/lib/grafana
- ./grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
- ./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
- ./grafana/statping_dashboard.json:/etc/grafana/provisioning/dashboards/statping_dashboard.json
- ./dev/docker/grafana:/var/lib/grafana
- ./dev/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
- ./dev/grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
- ./dev/grafana/statping_dashboard.json:/etc/grafana/provisioning/dashboards/statping_dashboard.json
environment:
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_ANONYMOUS_ENABLED=true

2
dev/postman.json vendored
View File

@ -4205,7 +4205,7 @@
"",
"pm.test(\"View All Notifiers\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.length).to.eql(14);",
" pm.expect(jsonData.length).to.eql(13);",
"});"
],
"type": "text/javascript"

View File

@ -7,8 +7,8 @@ const tokenKey = "statping_auth";
class Api {
constructor() {
this.version = "0.90.74";
this.commit = "df8e1f73d9f7fdf218bc5c26130d7d8a6af6719a";
this.version = "0.91.0";
this.commit = "b7ecf0c31b0c75c394061d2f6457a925e4440f1e";
}
async oauth() {
@ -275,7 +275,7 @@ class Api {
}
async github_release() {
return fetch('https://api.github.com/repos/statping/statping/releases/latest').then(response => response.json())
return fetch('https://api.github.com/repos/statping-ng/statping-ng/releases/latest').then(response => response.json())
}
async allActions(...all) {

View File

@ -6,11 +6,11 @@
</div>
<div class="col-4">
<span class="font-5 d-block font-weight-bold">{{service.online_24_hours}} %</span>
<span class="font-1 subtitle">{{$t('last_uptime', [24, $tc('hour', 24)])}}</span>
<span class="font-1 subtitle">{{$t('last_uptime')}} 24 {{$tc('hour', 24)}}</span>
</div>
<div class="col-4">
<span class="font-5 d-block font-weight-bold">{{service.online_7_days}} %</span>
<span class="font-1 subtitle">{{$t('last_uptime', [7, $tc('day', 7)])}}</span>
<span class="font-1 subtitle">{{$t('last_uptime')}} 7 {{$tc('day', 7)}}</span>
</div>
</div>
</template>

View File

@ -1,7 +1,7 @@
<template>
<form @submit.prevent="saveSettings">
<div class="card">
<div class="card-header">Statping Settings</div>
<div class="card-header">Statping-ng Settings</div>
<div class="card-body">
<div class="form-group">
<label>{{ $t('project_name') }}</label>

View File

@ -94,12 +94,13 @@
<div class="col-sm-8">
<select v-model="service.method" name="method" class="form-control">
<option value="GET" >GET</option>
<option value="HEAD" >HEAD</option>
<option value="POST" >POST</option>
<option value="DELETE" >DELETE</option>
<option value="PATCH" >PATCH</option>
<option value="PUT" >PUT</option>
</select>
<small class="form-text text-muted">A GET request will simply request the endpoint, you can also send data with POST.</small>
<small class="form-text text-muted">A GET/HEAD request will simply request the endpoint, you can also send data with POST.</small>
</div>
</div>

View File

@ -52,8 +52,8 @@ const chinese = {
days_ago: "天前",
today: "今天",
week: "周",
month: "月份",
day: "日",
month: "月份 | 月数",
day: "日 | 天数",
hour: "小时",
minute: "分钟",
failures_24_hours: "过去 24 小时失败",
@ -139,4 +139,4 @@ const chinese = {
service_create: "创建服务"
}
export default chinese
export default chinese

View File

@ -37,7 +37,7 @@ const czech = {
type: "Typ",
edit: "Upravit",
update: "Aktualizovat",
create: "Vytvořot",
create: "Vytvořit",
view: "Zobrazit",
save: "Uložit",
title: "Název",

View File

@ -51,11 +51,11 @@ const english = {
service_offline_time: "Service has been offline for",
days_ago: "Days Ago",
today: "Today",
week: "Week",
month: "Month",
day: "Day",
hour: "Hour",
minute: "Minute",
week: "Week | Weeks",
month: "Month | Months",
day: "Day | Days",
hour: "Hour | Hours",
minute: "Minute | Minutes",
failures_24_hours: "Failures last 24 hours",
no_services: "You currently don't have any services!",
theme: "Theme",
@ -139,4 +139,4 @@ const english = {
service_create: "Create Service"
}
export default english
export default english

View File

@ -51,11 +51,11 @@ const french = {
service_offline_time: "Le service a été hors ligne pour",
days_ago: "Il y a jours",
today: "Aujourd'hui",
week: "Semaine",
week: "Semaine | Semaines",
month: "Mois",
day: "Jour",
hour: "Heure",
minute: "Minute",
day: "Jour | Jours",
hour: "Heure | Heures",
minute: "Minute | Minutes",
failures_24_hours: "Les échecs durent 24 heures",
no_services: "Vous n'avez actuellement aucun service !",
theme: "Thème",
@ -109,7 +109,7 @@ const french = {
notify_before: "Avertir avant",
message_create: "Créer une annonce",
message_edit: "Modifier l'annonce",
minutes: "Procès-Verbal",
minutes: "Minutes",
hours: "Heures",
days: "Jours",
user_create: "Créer un utilisateur",
@ -139,4 +139,4 @@ const french = {
service_create: "Créer un service"
}
export default french
export default french

View File

@ -51,11 +51,11 @@ const german = {
service_offline_time: "Dienst war offline für",
days_ago: "Tage vergangen",
today: "Heute",
week: "Woche",
month: "Monat",
day: "Tag",
hour: "Stunde",
minute: "Minute",
week: "Woche | Wochen",
month: "Monat | Monate",
day: "Tag | Tage",
hour: "Stunde | Stunden",
minute: "Minute | Minuten",
failures_24_hours: "Ausfälle letzte 24 Stunden",
no_services: "Sie haben derzeit keine Dienste!",
theme: "Thema",

View File

@ -51,10 +51,10 @@ const italian = {
service_offline_time: "Il servizio è stato offline per",
days_ago: "Giorni fa",
today: "Oggi",
week: "Settimana",
month: "Mese",
day: "Giorno",
hour: "Ora",
week: "Settimana | Settimane",
month: "Mese | Mesi",
day: "Giorno | Giorni",
hour: "Ora | Ore",
minute: "Minuti",
failures_24_hours: "Errori nelle ultime 24 ore",
no_services: "Al momento non hai alcun servizio!",
@ -139,4 +139,4 @@ const italian = {
service_create: "Crea servizio"
}
export default italian
export default italian

View File

@ -51,11 +51,11 @@ const japanese = {
service_offline_time: "のサービスがオフラインになりました",
days_ago: "日前",
today: "今日",
week: "週数",
month: "月",
day: "日",
hour: "アワー",
minute: "分",
week: "週数 | 週",
month: "月 | ヶ月",
day: "日 | 日数",
hour: "アワー | 時間",
minute: "分 | 議事録",
failures_24_hours: "過去 24 時間の障害",
no_services: "現在、サービスをお持ちになりません。",
theme: "テーマ",
@ -139,4 +139,4 @@ const japanese = {
service_create: "サービスの作成"
}
export default japanese
export default japanese

View File

@ -55,7 +55,7 @@ const korean = {
month: "월",
day: "일",
hour: "시간",
minute: "분",
minute: "분 | 의사록",
failures_24_hours: "지난 24시간 동안 장애 발생",
no_services: "현재 서비스가 없습니다!",
theme: "테마",
@ -139,4 +139,4 @@ const korean = {
service_create: "서비스 만들기"
}
export default korean
export default korean

View File

@ -1,12 +1,12 @@
const russian = {
settings: "Настройки",
dashboard: "Панель управления",
services: "служб",
service: "обслуживания",
dashboard: "Панель",
services: "Сервисы",
service: "Сервис",
failures: "Сбои",
users: "Пользователи",
login: "Войти",
logout: "Выход из системы",
logout: "Выход",
online: "Онлайн",
offline: "Оффлайн",
configs: "Конфигурация",
@ -22,42 +22,42 @@ const russian = {
regen_api: "Регенерация ключей API",
regen_desc: "API Secret используется для чтения создания обновлений и удаления маршрутов. Вы можете регенерировать ключи API, если вам нужно.",
visibility: "Видимость",
group: "Группы",
group: "Группа",
group_create: "Создать группу",
group_update: "Обновить группу",
group_public_desc: "Показать групповые услуги публике",
group_public_desc: "Показавать группу публично всем",
groups: "Группы",
no_group: "Нет группы",
public: "Общественный",
private: "Частные",
public: "Публичный",
private: "Приватный",
announcements: "Объявления",
notifiers: "Уведомлятели",
notifiers: "Способы уведомлений",
logs: "Журналы",
help: "Помогите",
help: "Помощь",
type: "Тип",
edit: "Редактировать",
update: "Обновить",
create: "Создайте",
create: "Создать",
view: "Посмотреть",
save: "Сохранить",
title: "Название",
status: "положению",
begins: "Начинается",
total_services: "Всего услуг",
status: "Статус",
begins: "Начало",
total_services: "Всего сервисов",
online_services: "Онлайн-сервисы",
request_timeout: "Тайм-аут запроса",
service_never_online: "Сервис никогда не был в сети",
service_online_check: "Проверено онлайн",
service_offline_time: "Служба была отключена для",
service_offline_time: "Сервис был отключен для",
days_ago: "Дней назад",
today: "Сегодня",
week: "Недели",
month: "Месяц",
day: "День",
hour: "Час",
minute: "Минута",
month: "Месяц | Месяцы",
day: "День | Дней",
hour: "Час | Часов",
minute: "Минута | Минуты",
failures_24_hours: "Сбои за 24 часа",
no_services: "В настоящее время у вас нет услуг!",
no_services: "В настоящее время у вас нет сервисов!",
theme: "Тема",
cache: "Кэш",
authentication: "Проверка подлинности",
@ -76,20 +76,20 @@ const russian = {
db_password: "Пароль базы данных",
db_database: "Имя базы данных",
send_reports: "Отправка отчетов об ошибках",
send_reports_desc: "Отправить ошибки в Statping для отладки",
send_reports_desc: "Отправлять ошибки в Statping для отладки",
project_name: "Имя страницы состояния",
description: "Описание",
domain: "Домен",
enable_cdn: "Включить CDN",
newsletter: "Информационный бюллетень",
newsletter_note: "Мы отправим вам только сообщение по электронной почте для серьезных изменений",
newsletter: "Рассылка новостей",
newsletter_note: "Мы отправим вам электронное письмо только в случае серьезных изменений",
loading: "Загрузка",
save_settings: "Сохранить настройки",
average_response: "Средний ответ",
last_uptime: "Время безотказной работы",
sign_in: "Войти",
last_login: "Последний вход",
admin: "Администратор",
admin: "Админ",
user: "Пользователя",
failed: "Не удалось",
wrong_login: "Неверное имя пользователя или пароль",
@ -99,7 +99,7 @@ const russian = {
assets_btn: "Включить локальные ресурсы",
assets_loading: "Создание компонентов",
assets_dir: "Каталог активов",
footer: "Подколонтитул",
footer: "Нижний колонтитул (footer)",
footer_notes: "Вы можете использовать HTML-теги в нижнем колонтитуле",
global_announcement: "Глобальное объявление",
announcement_date: "Диапазон дат объявления",
@ -114,29 +114,29 @@ const russian = {
days: "Дни",
user_create: "Создать пользователя",
user_update: "Обновить пользователя",
administrator: "Администратора",
checkins: "Чеккинс",
administrator: "Администратор",
checkins: "Проверки",
incidents: "Инциденты",
service_info: "Информация о сервисе",
service_name: "Имя службы",
service_type: "Тип услуги",
service_name: "Имя сервиса",
service_type: "Тип сервиса",
permalink: "URL-адрес Постоянной ссылки",
service_public: "Государственная служба",
service_public: "Видимость публично",
check_interval: "Интервал проверки",
service_endpoint: "Конечная точка службы",
service_check: "Тип проверки службы",
service_endpoint: "Адрес проверяемого хоста",
service_check: "Тип проверки",
service_timeout: "Тайм-аут запроса",
expected_resp: "Ожидаемый ответ",
expected_code: "Код ожидаемого состояния",
follow_redir: "Следуйте за перенаправленными",
verify_ssl: "Проверить SSL",
follow_redir: "Вкл. следование по редиректам",
verify_ssl: "Проверять SSL",
tls_cert: "Использовать сертификат TLS",
notification_opts: "Параметры уведомления",
notifications_enable: "Включить уведомления",
notify_after: "Уведомлять после сбоев",
notify_all: "Уведомлять обо всех изменениях",
service_update: "Обновить службу",
service_create: "Создать службу"
service_update: "Обновить сервис",
service_create: "Создать сервис"
}
export default russian
export default russian

View File

@ -51,11 +51,11 @@ const spanish = {
service_offline_time: "El servicio ha estado desconectado para",
days_ago: "Hace días",
today: "Hoy",
week: "Semana",
month: "Mes",
day: "Día",
hour: "Hora",
minute: "Minuto",
week: "Semana | Semanas",
month: "Mes | Meses",
day: "Día | Días",
hour: "Hora | Horas",
minute: "Minuto | Minutos",
failures_24_hours: "Fallos de las últimas 24 horas",
no_services: "¡Actualmente no tienes ningún servicio!",
theme: "Tema",
@ -139,4 +139,4 @@ const spanish = {
service_create: "Crear servicio"
}
export default spanish
export default spanish

View File

@ -12,27 +12,28 @@
</div>
</div>
<div class="col-12 full-col-12">
<div v-for="service in services_no_group" v-bind:key="service.id" class="list-group online_list mb-4">
<div class="list-group-item list-group-item-action">
<router-link class="no-decoration font-3" :to="serviceLink(service)">{{service.name}}</router-link>
<span class="badge float-right" :class="{'bg-success': service.online, 'bg-danger': !service.online }">{{service.online ? "ONLINE" : "OFFLINE"}}</span>
<GroupServiceFailures :service="service"/>
<IncidentsBlock :service="service"/>
</div>
</div>
</div>
<div class="col-12 full-col-12">
<MessageBlock v-for="message in messages" v-bind:key="message.id" :message="message" />
</div>
<div class="col-12 full-col-12">
<div v-for="service in services_no_group" v-bind:key="service.id" class="list-group online_list mb-4">
<div class="list-group-item list-group-item-action">
<router-link class="no-decoration font-3" :to="serviceLink(service)">{{service.name}}</router-link>
<span class="badge float-right" :class="{'bg-success': service.online, 'bg-danger': !service.online }">{{service.online ? "ONLINE" : "OFFLINE"}}</span>
<GroupServiceFailures :service="service"/>
<IncidentsBlock :service="service"/>
</div>
</div>
</div>
<Group v-for="group in groups" v-bind:key="group.id" :group=group />
<div class="col-12 full-col-12">
<MessageBlock v-for="message in messages" v-bind:key="message.id" :message="message" />
</div>
<div class="col-12 full-col-12">
<div v-for="service in services" :ref="service.id" v-bind:key="service.id">
<ServiceBlock :service="service" />
</div>
</div>
<div class="col-12 full-col-12">
<div v-for="service in services" :ref="service.id" v-bind:key="service.id">
<ServiceBlock :service="service" />
</div>
</div>
</div>
</template>

View File

@ -61,7 +61,7 @@ export default {
const ts = data.match(/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]/gm)
return {
time: ts[0],
message: data.split(ts+": ")[1]
message: data.split(ts+": ")[1] || ''
}
},
cleanLog(l) {

View File

@ -46,7 +46,7 @@
</a>
</div>
<h6 class="mt-4 mb-3 text-muted">Statping {{$t('links')}}</h6>
<h6 class="mt-4 mb-3 text-muted">Statping-ng {{$t('links')}}</h6>
<a href="https://statping-ng.github.io" class="mb-2 font-2 text-decoration-none text-muted">
<font-awesome-icon icon="globe" class="mr-3"/> Statping-ng
@ -68,7 +68,7 @@
<font-awesome-icon icon="code-branch" class="mr-3"/> {{$t('repo')}}
</a>
<span class="small text-dim text-center mt-5">Statping v{{core.version}}<br>
<span class="small text-dim text-center mt-5">Statping-ng v{{core.version}}<br>
<a class="small text-muted no-decoration" v-if="core.commit" v-bind:href="`https://github.com/statping-ng/statping-ng/commit/${core.commit}`">{{core.commit.slice(0,8)}}</a>
</span>

View File

@ -1,13 +1,13 @@
module.exports = {
baseUrl: '/',
publicPath: '/',
assetsDir: 'assets',
filenameHashing: false,
productionTip: process.env.NODE_ENV !== 'production',
devtools: process.env.NODE_ENV !== 'production',
performance: process.env.NODE_ENV !== 'production',
// productionTip: process.env.NODE_ENV !== 'production',
// devtools: process.env.NODE_ENV !== 'production',
// performance: process.env.NODE_ENV !== 'production',
devServer: {
disableHostCheck: true,
proxyTable: {
proxy: {
'/api': {
logLevel: 'debug',
target: 'http://0.0.0.0:8585',

118
go.mod
View File

@ -1,10 +1,10 @@
module github.com/statping-ng/statping-ng
// +heroku goVersion go1.14
go 1.14
// +heroku goVersion go1.17
go 1.17
require (
github.com/GeertJohan/go.rice v1.0.0
github.com/GeertJohan/go.rice v1.0.2
github.com/aws/aws-sdk-go v1.30.20
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fatih/structs v1.1.0
@ -12,8 +12,7 @@ require (
github.com/foomo/tlsconfig v0.0.0-20180418120404-b67861b076c9
github.com/getsentry/sentry-go v0.5.1
github.com/go-mail/mail v2.3.1+incompatible
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/go-cmp v0.5.1 // indirect
github.com/go-ping/ping v1.1.0
github.com/gorilla/mux v1.7.4
github.com/hako/durafmt v0.0.0-20200605151348-3a43fc422dd9
github.com/jinzhu/gorm v1.9.12
@ -24,19 +23,110 @@ require (
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.6.3
github.com/statping-ng/emails v1.0.3
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.6.1
github.com/t-tiger/gorm-bulk-insert/v2 v2.0.1
go.uber.org/atomic v1.6.0 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 // indirect
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20201012192620-5bd05386311b // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/grpc v1.28.1
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.3.0
)
require (
cloud.google.com/go v0.56.0 // indirect
github.com/Azure/azure-sdk-for-go v41.3.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.10.0 // indirect
github.com/Azure/go-autorest/autorest/adal v0.8.3 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.3.1 // indirect
github.com/Azure/go-autorest/autorest/date v0.2.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.2.0 // indirect
github.com/Azure/go-autorest/logger v0.1.0 // indirect
github.com/Azure/go-autorest/tracing v0.5.0 // indirect
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87 // indirect
github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.11 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.131 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.0.2 // indirect
github.com/cloudflare/cloudflare-go v0.11.6 // indirect
github.com/cpu/goacmedns v0.0.2 // indirect
github.com/daaku/go.zipexe v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimchansky/utfbom v1.1.0 // indirect
github.com/dnsimple/dnsimple-go v0.60.0 // indirect
github.com/exoscale/egoscale v0.18.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-acme/lego/v3 v3.7.0 // indirect
github.com/go-errors/errors v1.0.2 // indirect
github.com/go-resty/resty/v2 v2.2.0 // indirect
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/gophercloud/gophercloud v0.10.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/labbsr0x/bindman-dns-webhook v1.0.2 // indirect
github.com/labbsr0x/goh v1.0.1 // indirect
github.com/lextoumbourou/goodhosts v2.1.0+incompatible // indirect
github.com/lib/pq v1.3.0 // indirect
github.com/linode/linodego v0.14.0 // indirect
github.com/liquidweb/liquidweb-go v1.6.1 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.1.29 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04 // indirect
github.com/nrdcg/auroradns v1.0.1 // indirect
github.com/nrdcg/dnspod-go v0.4.0 // indirect
github.com/nrdcg/goinwx v0.6.1 // indirect
github.com/nrdcg/namesilo v0.2.1 // indirect
github.com/oracle/oci-go-sdk v17.4.0+incompatible // indirect
github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/prometheus/common v0.6.0 // indirect
github.com/prometheus/procfs v0.0.3 // indirect
github.com/sacloud/libsacloud v1.36.1 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7 // indirect
github.com/transip/gotransip/v6 v6.0.2 // indirect
github.com/vultr/govultr v0.3.3 // indirect
go.opencensus.io v0.22.3 // indirect
go.uber.org/ratelimit v0.1.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
google.golang.org/api v0.21.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/ns1/ns1-go.v2 v2.3.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

50
go.sum
View File

@ -74,8 +74,9 @@ github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mo
github.com/DATA-DOG/go-sqlmock v1.4.1 h1:ThlnYciV1iM/V0OSF/dtkqWb6xo5qITT1TJBG1MRDJM=
github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.0 h1:KkI6O9uMaQU3VEKaj01ulavtF7o1fWT7+pk/4voiMLQ=
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/GeertJohan/go.rice v1.0.2 h1:PtRw+Tg3oa3HYwiDBZyvOJ8LdIyf6lAovJJtr7YOAYk=
github.com/GeertJohan/go.rice v1.0.2/go.mod h1:af5vUNlDNkCjOZeSGFgIJxDje9qdjsO6hshx0gTmZt4=
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
@ -174,8 +175,9 @@ github.com/foomo/simplecert v1.7.5/go.mod h1:RojYROT3nMm8GtJZAPUz0sM5YuSQ/6MIdZv
github.com/foomo/tlsconfig v0.0.0-20180418120404-b67861b076c9 h1:RPOsDNbnDUFaSt/3bCxUsaGCJsKqA6dGubevl20nE9g=
github.com/foomo/tlsconfig v0.0.0-20180418120404-b67861b076c9/go.mod h1:OdiGKKgTAfMv7x9Hh9qYFueue77tr09LUAxwy2+M8wY=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
github.com/getsentry/sentry-go v0.5.1 h1:MIPe7ScHADsrK2vznqmhksIUFxq7m0JfTh+ZIMkI+VQ=
github.com/getsentry/sentry-go v0.5.1/go.mod h1:B8H7x8TYDPkeWPRzGpIiFO97LZP6rL8A3hEt8lUItMw=
@ -198,6 +200,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
github.com/go-mail/mail v2.3.1+incompatible h1:UzNOn0k5lpfVtO31cK3hn6I4VEVGhe3lX8AJBAxXExM=
github.com/go-mail/mail v2.3.1+incompatible/go.mod h1:VPWjmmNyRsWXQZHVHT3g0YbIINUkSmuKOiLIDkWbL6M=
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
github.com/go-ping/ping v1.1.0 h1:3MCGhVX4fyEUuhsfwPrsEdQw6xspHkv5zHsiSoDFZYw=
github.com/go-ping/ping v1.1.0/go.mod h1:xIFjORFzTxqIV/tDVGO4eDy/bLuSyawEeojSm3GfRGk=
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
github.com/go-resty/resty/v2 v2.2.0 h1:vgZ1cdblp8Aw4jZj3ZsKh6yKAlMg3CHMrqFSFFd+jgY=
github.com/go-resty/resty/v2 v2.2.0/go.mod h1:nYW/8rxqQCmI3bPz9Fsmjbr2FBjGuR2Mzt6kDh3zZ7w=
@ -264,8 +268,10 @@ github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
@ -419,11 +425,11 @@ github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY
github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM=
github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/nkovacs/streamquote v1.0.0/go.mod h1:BN+NaZ2CmdKqUuTUXUEm9j95B2TRbpOWpxbJYzzgUsc=
github.com/nrdcg/auroradns v1.0.1 h1:m/kBq83Xvy3cU261MOknd8BdnOk12q4lAWM+kOdsC2Y=
github.com/nrdcg/auroradns v1.0.1/go.mod h1:y4pc0i9QXYlFCWrhWrUSIETnZgrf4KuwjDIWmmXo3JI=
github.com/nrdcg/dnspod-go v0.4.0 h1:c/jn1mLZNKF3/osJ6mz3QPxTudvPArXTjpkmYj0uK6U=
@ -585,6 +591,7 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDf
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@ -620,8 +627,9 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -643,7 +651,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
@ -653,8 +660,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 h1:xUIPaMhvROX9dhPvRCenIJtU78+lbEenGbgqB5hfHCQ=
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -688,8 +695,12 @@ golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -703,8 +714,11 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -743,14 +757,26 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/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-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -796,8 +822,8 @@ golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20201012192620-5bd05386311b h1:Imq6ZJ3mzzAkU1yzH1aHpiF3lTs3ySLzjH8SEfFdW0A=
golang.org/x/tools v0.0.0-20201012192620-5bd05386311b/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -1,13 +1,14 @@
package handlers
import (
"net"
"net/http"
"github.com/gorilla/mux"
"github.com/statping-ng/statping-ng/types/checkins"
"github.com/statping-ng/statping-ng/types/errors"
"github.com/statping-ng/statping-ng/types/services"
"github.com/statping-ng/statping-ng/utils"
"net"
"net/http"
)
func findCheckin(r *http.Request) (*checkins.Checkin, string, error) {
@ -23,8 +24,9 @@ func findCheckin(r *http.Request) (*checkins.Checkin, string, error) {
return checkin, id, nil
}
func apiAllCheckinsHandler(w http.ResponseWriter, r *http.Request) {
returnJson(checkins.All(), w, r)
func apiAllCheckinsHandler(r *http.Request) interface{} {
checkins := checkins.All()
return checkins
}
func apiCheckinHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -3,13 +3,13 @@ package handlers
import (
"encoding/json"
"fmt"
"github.com/statping-ng/statping-ng/types/errors"
"html/template"
"net/http"
"path"
"time"
"github.com/statping-ng/statping-ng/source"
"github.com/statping-ng/statping-ng/types/errors"
"github.com/statping-ng/statping-ng/utils"
)
@ -73,7 +73,11 @@ func IsReadAuthenticated(r *http.Request) bool {
if ok := hasAuthorizationHeader(r); ok {
return true
}
return IsFullAuthenticated(r)
_, err := getJwtToken(r)
if err == nil {
return true
}
return false
}
// IsFullAuthenticated returns true if the HTTP request is authenticated. You can set the environment variable GO_ENV=test
@ -172,13 +176,24 @@ func ExecuteResponse(w http.ResponseWriter, r *http.Request, file string, data i
if err != nil {
log.Errorln(err)
}
render, err := source.TmplBox.String(file)
if err != nil {
log.Errorln(err)
}
// render the page requested
if _, err := mainTemplate.Parse(render); err != nil {
log.Errorln(err)
asset := file
if source.UsingAssets(utils.Directory) {
asset = utils.Directory + "/assets/" + file
if _, err := mainTemplate.ParseFiles(asset); err != nil {
log.Errorln(err)
}
} else {
render, err := source.TmplBox.String(asset)
if err != nil {
log.Errorln(err)
}
// render the page requested
if _, err := mainTemplate.Parse(render); err != nil {
log.Errorln(err)
}
}
// execute the template
if err := mainTemplate.Execute(w, data); err != nil {

View File

@ -1,29 +1,29 @@
package handlers
import (
"net/http"
"sort"
"github.com/gorilla/mux"
"github.com/statping-ng/statping-ng/types/errors"
"github.com/statping-ng/statping-ng/types/failures"
"github.com/statping-ng/statping-ng/types/notifications"
"github.com/statping-ng/statping-ng/types/services"
"net/http"
"sort"
)
func apiNotifiersHandler(w http.ResponseWriter, r *http.Request) {
func apiAllNotifiersHandler(r *http.Request) interface{} {
var notifs []notifications.Notification
for _, n := range services.AllNotifiers() {
notif := n.Select()
no, err := notifications.Find(notif.Method)
if err != nil {
log.Error(err)
sendErrorJson(err, w, r)
}
notif.UpdateFields(no)
notifs = append(notifs, *notif)
}
sort.Sort(notifications.NotificationOrder(notifs))
returnJson(notifs, w, r)
return notifs
}
func apiNotifierGetHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -1,13 +1,14 @@
package handlers
import (
"net/http"
"net/http/pprof"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/statping-ng/statping-ng/source"
"github.com/statping-ng/statping-ng/types/core"
"github.com/statping-ng/statping-ng/utils"
"net/http"
"net/http/pprof"
_ "github.com/statping-ng/statping-ng/types/metrics"
)
@ -146,7 +147,7 @@ func Router() *mux.Router {
api.Handle("/api/incidents/{id}/updates/{uid}", authenticated(apiDeleteIncidentUpdateHandler, false)).Methods("DELETE")
// API USER Routes
api.Handle("/api/users", authenticated(apiAllUsersHandler, false)).Methods("GET")
api.Handle("/api/users", scoped(apiAllUsersHandler)).Methods("GET")
api.Handle("/api/users", authenticated(apiCreateUsersHandler, false)).Methods("POST")
api.Handle("/api/users/token", http.HandlerFunc(apiCheckUserTokenHandler)).Methods("POST")
api.Handle("/api/users/{id}", authenticated(apiUserHandler, false)).Methods("GET")
@ -154,7 +155,7 @@ func Router() *mux.Router {
api.Handle("/api/users/{id}", authenticated(apiUserDeleteHandler, false)).Methods("DELETE")
// API NOTIFIER Routes
api.Handle("/api/notifiers", authenticated(apiNotifiersHandler, false)).Methods("GET")
api.Handle("/api/notifiers", scoped(apiAllNotifiersHandler)).Methods("GET")
api.Handle("/api/notifier/{notifier}", authenticated(apiNotifierGetHandler, false)).Methods("GET")
api.Handle("/api/notifier/{notifier}", authenticated(apiNotifierUpdateHandler, false)).Methods("POST")
api.Handle("/api/notifier/{notifier}/test", authenticated(testNotificationHandler, false)).Methods("POST")
@ -167,7 +168,7 @@ func Router() *mux.Router {
api.Handle("/api/messages/{id}", authenticated(apiMessageDeleteHandler, false)).Methods("DELETE")
// API CHECKIN Routes
api.Handle("/api/checkins", authenticated(apiAllCheckinsHandler, false)).Methods("GET")
api.Handle("/api/checkins", scoped(apiAllCheckinsHandler)).Methods("GET")
api.Handle("/api/checkins", authenticated(checkinCreateHandler, false)).Methods("POST")
api.Handle("/api/checkins/{api}", authenticated(apiCheckinHandler, false)).Methods("GET")
api.Handle("/api/checkins/{api}", authenticated(checkinDeleteHandler, false)).Methods("DELETE")

View File

@ -2,11 +2,12 @@ package handlers
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/statping-ng/statping-ng/types/errors"
"github.com/statping-ng/statping-ng/types/users"
"github.com/statping-ng/statping-ng/utils"
"net/http"
)
func findUser(r *http.Request) (*users.User, int64, error) {
@ -75,9 +76,9 @@ func apiUserDeleteHandler(w http.ResponseWriter, r *http.Request) {
sendJsonAction(user, "delete", w, r)
}
func apiAllUsersHandler(w http.ResponseWriter, r *http.Request) {
func apiAllUsersHandler(r *http.Request) interface{} {
allUsers := users.All()
returnJson(allUsers, w, r)
return allUsers
}
func apiCheckUserTokenHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@ -36,7 +36,6 @@ func InitNotifiers() {
Webhook,
Mobile,
Pushover,
statpingMailer,
Gotify,
AmazonSNS,
)

View File

@ -1,106 +0,0 @@
package notifiers
import (
"bytes"
"encoding/json"
"github.com/statping-ng/statping-ng/types/core"
"github.com/statping-ng/statping-ng/types/failures"
"github.com/statping-ng/statping-ng/types/notifications"
"github.com/statping-ng/statping-ng/types/notifier"
"github.com/statping-ng/statping-ng/types/services"
"github.com/statping-ng/statping-ng/utils"
"time"
)
var _ notifier.Notifier = (*statpingEmailer)(nil)
const (
statpingEmailerName = "statping_emailer"
statpingEmailerHost = "https://news.statping.com"
)
type statpingEmailer struct {
*notifications.Notification
}
func (s *statpingEmailer) Select() *notifications.Notification {
return s.Notification
}
func (s *statpingEmailer) Valid(values notifications.Values) error {
return nil
}
var statpingMailer = &statpingEmailer{&notifications.Notification{
Method: statpingEmailerName,
Title: "Email",
Description: "Send an email when a service becomes offline or back online using Statping's email service. You will need to verify your email address.",
Author: "Hunter Long",
AuthorUrl: "https://github.com/hunterlong",
Delay: time.Duration(10 * time.Second),
Icon: "fas envelope-square",
Limits: 60,
Form: []notifications.NotificationForm{{
Type: "email",
Title: "Send to Email Address",
Placeholder: "info@statping.com",
DbField: "Host",
Required: true,
}}},
}
// Send will send a HTTP Post to the slack webhooker API. It accepts type: string
func (s *statpingEmailer) sendStatpingEmail(msg statpingMail) (string, error) {
data, _ := json.Marshal(msg)
resp, _, err := utils.HttpRequest(statpingEmailerHost+"/notifier", "POST", "application/json", nil, bytes.NewBuffer(data), time.Duration(10*time.Second), true, nil)
if err != nil {
return "", err
}
return string(resp), nil
}
func (s *statpingEmailer) OnTest() (string, error) {
return "", nil
}
type statpingMail struct {
Email string `json:"email"`
Core core.Core `json:"core,omitempty"`
Service services.Service `json:"service,omitempty"`
Failure failures.Failure `json:"failure,omitempty"`
}
// OnFailure will trigger failing service
func (s *statpingEmailer) OnFailure(srv services.Service, f failures.Failure) (string, error) {
ee := statpingMail{
Email: s.Host.String,
Core: *core.App,
Service: srv,
Failure: f,
}
return s.sendStatpingEmail(ee)
}
// OnSuccess will trigger successful service
func (s *statpingEmailer) OnSuccess(srv services.Service) (string, error) {
ee := statpingMail{
Email: s.Host.String,
Core: *core.App,
Service: srv,
Failure: failures.Failure{},
}
return s.sendStatpingEmail(ee)
}
// OnSave will trigger when this notifier is saved
func (s *statpingEmailer) OnSave() (string, error) {
ee := statpingMail{
Email: s.Host.String,
Core: *core.App,
Service: services.Service{},
Failure: failures.Failure{},
}
out, err := s.sendStatpingEmail(ee)
log.Println("statping emailer response", out)
return out, err
}

View File

@ -1,70 +0,0 @@
package notifiers
import (
"github.com/statping-ng/statping-ng/database"
"github.com/statping-ng/statping-ng/types/core"
"github.com/statping-ng/statping-ng/types/failures"
"github.com/statping-ng/statping-ng/types/notifications"
"github.com/statping-ng/statping-ng/types/null"
"github.com/statping-ng/statping-ng/types/services"
"github.com/statping-ng/statping-ng/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
"time"
)
var (
testEmail string
)
func TestStatpingEmailerNotifier(t *testing.T) {
err := utils.InitLogs()
require.Nil(t, err)
t.Parallel()
db, err := database.OpenTester()
require.Nil(t, err)
db.AutoMigrate(&notifications.Notification{})
notifications.SetDB(db)
core.Example()
testEmail = utils.Params.GetString("TEST_EMAIL")
statpingMailer.Host = null.NewNullString(testEmail)
statpingMailer.Enabled = null.NewNullBool(true)
if testEmail == "" {
t.Log("statping email notifier testing skipped, missing TEST_EMAIL environment variable")
t.SkipNow()
}
t.Run("Load statping emailer", func(t *testing.T) {
statpingMailer.Host = null.NewNullString(testEmail)
statpingMailer.Delay = time.Duration(100 * time.Millisecond)
statpingMailer.Limits = 3
Add(statpingMailer)
assert.Equal(t, "Hunter Long", statpingMailer.Author)
assert.Equal(t, testEmail, statpingMailer.Host.String)
})
t.Run("statping emailer Within Limits", func(t *testing.T) {
ok := statpingMailer.CanSend()
assert.True(t, ok)
})
t.Run("statping emailer OnSave", func(t *testing.T) {
_, err := statpingMailer.OnSave()
assert.Nil(t, err)
})
t.Run("statping emailer OnFailure", func(t *testing.T) {
_, err := statpingMailer.OnFailure(services.Example(false), failures.Example())
assert.Nil(t, err)
})
t.Run("statping emailer OnSuccess", func(t *testing.T) {
_, err := statpingMailer.OnSuccess(services.Example(true))
assert.Nil(t, err)
})
}

View File

@ -30,6 +30,7 @@ var (
"scss/mobile.scss",
"scss/variables.scss",
"robots.txt",
"base.gohtml",
}
)
@ -174,8 +175,8 @@ func DeleteAllAssets(folder string) error {
// CopyAllToPublic will copy all the files in a rice box into a local folder
func CopyAllToPublic(box *rice.Box) error {
exclude := map[string]bool{
"base.gohtml": true,
"index.html": true,
// "base.gohtml": true,
"index.html": true,
}
return box.Walk("/", func(path string, info os.FileInfo, err error) error {

@ -0,0 +1 @@
Subproject commit a42b2a641164e4c714fc09d6e08fcd6f7d0e5fb4

View File

@ -23,9 +23,12 @@ func sendSuccess(s *Service) {
return
}
s.notifyAfterCount = 0
if s.prevOnline == s.Online {
return
}
s.prevOnline = true
for _, n := range allNotifiers {
notif := n.Select()
@ -42,9 +45,6 @@ func sendSuccess(s *Service) {
notif.LastSent = utils.Now()
}
}
s.prevOnline = true
s.notifyAfterCount++
}
func sendFailure(s *Service, f *failures.Failure) {
@ -63,6 +63,8 @@ func sendFailure(s *Service, f *failures.Failure) {
}
}
s.prevOnline = false
for _, n := range allNotifiers {
notif := n.Select()
if notif.CanSend() {
@ -78,9 +80,6 @@ func sendFailure(s *Service, f *failures.Failure) {
notif.LastSent = utils.Now()
}
}
s.prevOnline = false
s.notifyAfterCount++
}
func logMessage(method string, msg string, error error, onSuccesss bool, serviceId int64) {

View File

@ -159,7 +159,7 @@ func Samples() error {
s6 := &Service{
Name: "Private Service",
Domain: "https://push.statping.com",
Domain: "https://example.org",
Method: "GET",
Interval: 30,
Type: "http",

View File

@ -9,14 +9,15 @@ import (
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"sync"
"time"
"github.com/go-ping/ping"
"github.com/statping-ng/statping-ng/types/metrics"
)
@ -79,7 +80,8 @@ func ToString(s interface{}) string {
}
// Command will run a terminal command with 'sh -c COMMAND' and return stdout and errOut as strings
// in, out, err := Command("sass assets/scss assets/css/base.css")
//
// in, out, err := Command("sass assets/scss assets/css/base.css")
func Command(name string, args ...string) (string, string, error) {
testCmd := exec.Command(name, args...)
var stdout, stderr []byte
@ -215,17 +217,9 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
Proxy: http.ProxyFromEnvironment,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
// redirect all connections to host specified in url
addr = strings.Split(req.URL.Host, ":")[0] + addr[strings.LastIndex(addr, ":"):]
return dialer.DialContext(ctx, network, addr)
},
}
if Params.GetString("HTTP_PROXY") != "" {
proxyUrl, err := url.Parse(Params.GetString("HTTP_PROXY"))
if err != nil {
return nil, nil, err
}
transport.Proxy = http.ProxyURL(proxyUrl)
}
if customTLS != nil {
transport.TLSClientConfig.RootCAs = customTLS.RootCAs
transport.TLSClientConfig.Certificates = customTLS.Certificates
@ -257,3 +251,31 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
return contents, resp, err
}
func Ping(address string, secondsTimeout int) (int64, error) {
ping, err := ping.NewPinger(address)
if err != nil {
return 0, err
}
ping.Count = 1
ping.Timeout = time.Second * time.Duration(secondsTimeout)
if runtime.GOOS == "windows" {
ping.SetPrivileged(true)
}
err = ping.Run()
if err != nil {
return 0, err
}
stats := ping.Statistics()
if stats.PacketsSent-stats.PacketsRecv != 0 {
return 0, errors.New("destination host unreachable")
}
return stats.MinRtt.Microseconds(), nil
}

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package utils
@ -22,42 +23,33 @@ func DirWritable(path string) (bool, error) {
return false, errors.New("path isn't a directory")
}
if info.Mode().Perm()&(1<<(uint(7))) == 0 {
return false, errors.New("write permission bit is not set on this file for user")
}
var stat syscall.Stat_t
if err = syscall.Stat(path, &stat); err != nil {
return false, errors.New("unable to get stat")
}
if uint32(os.Geteuid()) != stat.Uid {
return false, errors.New("user doesn't have permission to write to this directory")
}
return true, nil
}
func Ping(address string, secondsTimeout int) (int64, error) {
ping, err := exec.LookPath("ping")
if err != nil {
return 0, err
}
out, _, err := Command(ping, address, "-c", "1", "-W", strconv.Itoa(secondsTimeout))
if err != nil {
return 0, err
}
if strings.Contains(out, "Unknown host") {
return 0, errors.New("unknown host")
}
if strings.Contains(out, "100.0% packet loss") {
return 0, errors.New("destination host unreachable")
if uint32(os.Geteuid()) == stat.Uid {
if info.Mode().Perm()&(1<<7) != 0 {
// owner matches and has write permissions
return true, nil
} else {
return false, errors.New("owner doesn't have write permissions for this path")
}
}
r := regexp.MustCompile(`time=(.*) ms`)
strs := r.FindStringSubmatch(out)
if len(strs) < 2 {
return 0, errors.New("could not parse ping duration")
if uint32(os.Getegid()) == stat.Gid {
if info.Mode().Perm()&(1<<4) != 0 {
// group matches and has write permissions
return true, nil
} else {
return false, errors.New("group doesn't have write permissions for this path")
}
}
f, _ := strconv.ParseFloat(strs[1], 64)
return int64(f * 1000), nil
if info.Mode().Perm()&(1<<1) != 0 {
// all users have write permissions
return true, nil
}
return false, errors.New("user doesn't have write permissions for this path")
}

View File

@ -2,13 +2,14 @@ package utils
import (
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCreateLog(t *testing.T) {
@ -215,3 +216,10 @@ func TestPerlin(t *testing.T) {
assert.NotZero(t, p.Noise1D(hi/500))
}
}
func TestPing(t *testing.T) {
duration, error := Ping("localhost", 1)
assert.Nil(t, error)
assert.NotEqual(t, 0, duration)
}

View File

@ -3,10 +3,6 @@ package utils
import (
"errors"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
)
func DirWritable(path string) (bool, error) {
@ -25,24 +21,3 @@ func DirWritable(path string) (bool, error) {
return true, nil
}
func Ping(address string, secondsTimeout int) (int64, error) {
ping, err := exec.LookPath("ping")
if err != nil {
return 0, err
}
out, _, err := Command(ping, address, "-n", "1", "-w", strconv.Itoa(secondsTimeout*1000))
if err != nil {
return 0, err
}
if strings.Contains(out, "Destination Host Unreachable") {
return 0, errors.New("destination host unreachable")
}
r := regexp.MustCompile(`Average = (.*)ms`)
strs := r.FindStringSubmatch(out)
if len(strs) < 2 {
return 0, errors.New("could not parse ping duration")
}
f, _ := strconv.ParseFloat(strs[1], 64)
return int64(f * 1000), nil
}

View File

@ -1 +1 @@
0.90.79
0.91.0