Compare commits
20 Commits
6810f9b2ec
...
renovate/g
Author | SHA1 | Date | |
---|---|---|---|
c8b1696c3e | |||
d605a5efe1 | |||
0e4b129127 | |||
ee1ea7ab4c | |||
45db127d28 | |||
2a4daab858 | |||
58265a642d | |||
a1853c0c79 | |||
3ae593500f | |||
a9f1729748 | |||
368789bf78 | |||
a593dff15b
|
|||
7555bb3f67
|
|||
094aa2a96d
|
|||
ce78bf803b
|
|||
84622efe82 | |||
ba21427c06 | |||
c841695ed4
|
|||
416fc27f9e | |||
f9e9ef2dd1 |
28
.gitea/workflows/docker.yml
Normal file
28
.gitea/workflows/docker.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: Build docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.matterlinux.xyz
|
||||||
|
IMAGE: ${{gitea.repository}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: "https://github.com/actions/checkout@v4"
|
||||||
|
|
||||||
|
- name: Login to container repo
|
||||||
|
uses: "https://github.com/docker/login-action@v1"
|
||||||
|
with:
|
||||||
|
registry: ${{env.REGISTRY}}
|
||||||
|
username: ${{gitea.actor}}
|
||||||
|
password: ${{secrets.PACKAGES_TOKEN}}
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
docker build --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest .
|
||||||
|
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest
|
13
Dockerfile
13
Dockerfile
@ -1,17 +1,24 @@
|
|||||||
FROM golang:1.22.5
|
FROM golang:1.24.4
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY *.go ./
|
RUN useradd runner -r -u 1001 -d /app
|
||||||
|
RUN chown -R runner:runner /app
|
||||||
|
USER runner
|
||||||
|
|
||||||
COPY *.mod ./
|
COPY *.mod ./
|
||||||
COPY *.sum ./
|
COPY *.sum ./
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY *.go ./
|
||||||
|
COPY Makefile ./
|
||||||
COPY lib ./lib
|
COPY lib ./lib
|
||||||
COPY log ./log
|
COPY log ./log
|
||||||
COPY public ./public
|
COPY public ./public
|
||||||
COPY routes ./routes
|
COPY routes ./routes
|
||||||
COPY templates ./templates
|
COPY templates ./templates
|
||||||
|
|
||||||
RUN go build .
|
RUN make
|
||||||
|
|
||||||
ENTRYPOINT ["/app/tracker"]
|
ENTRYPOINT ["/app/tracker"]
|
||||||
|
18
README.md
18
README.md
@ -1,4 +1,7 @@
|
|||||||
# tracker | MatterLinux package tracker
|
# tracker | MatterLinux package tracker
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Soruce code of MatterLinux's package tracker, located at
|
Soruce code of MatterLinux's package tracker, located at
|
||||||
[tracker.matterlinux.xyz](https://tracker.matterlinux.xyz)
|
[tracker.matterlinux.xyz](https://tracker.matterlinux.xyz)
|
||||||
|
|
||||||
@ -8,6 +11,7 @@ is stored in the `config.json` file. Here is the configuration for tracking
|
|||||||
official MatterLinux 24 repos:
|
official MatterLinux 24 repos:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"interval": 5,
|
||||||
"pools": [
|
"pools": [
|
||||||
{
|
{
|
||||||
"display": "base (stable)",
|
"display": "base (stable)",
|
||||||
@ -38,23 +42,19 @@ official MatterLinux 24 repos:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Deployment
|
### Deployment
|
||||||
Web server can be built and deployed with docker compose using the following
|
Web server can be deployed with docker compose using the following configuration file:
|
||||||
configuration file:
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
tracker:
|
tracker:
|
||||||
image: mattertracker
|
container_name: mattertracker
|
||||||
restart: unless-stopped
|
image: git.matterlinux.xyz/matter/tracker
|
||||||
build:
|
|
||||||
context: ./
|
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:9877:9877"
|
- "127.0.0.1:9877:9877"
|
||||||
volumes:
|
volumes:
|
||||||
- "./config.json:/app/config.json:ro"
|
- "./config.json:/app/config.json:ro"
|
||||||
|
restart: unless-stopped
|
||||||
```
|
```
|
||||||
After saving the configuration file, you can build and run the docker container:
|
After saving the configuration file, you can run the docker container:
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
14
go.mod
14
go.mod
@ -3,23 +3,23 @@ module git.matterlinux.xyz/matter/tracker
|
|||||||
go 1.22.5
|
go 1.22.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd
|
github.com/bigkevmcd/go-configparser v0.0.0-20250311182818-a679eef33309
|
||||||
github.com/gofiber/fiber/v2 v2.52.5
|
github.com/gofiber/fiber/v2 v2.52.6
|
||||||
github.com/gofiber/template/html/v2 v2.1.2
|
github.com/gofiber/template/html/v2 v2.1.3
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||||
github.com/gofiber/template v1.8.3 // indirect
|
github.com/gofiber/template v1.8.3 // indirect
|
||||||
github.com/gofiber/utils v1.1.0 // indirect
|
github.com/gofiber/utils v1.1.0 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.17.11 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasthttp v1.55.0 // indirect
|
github.com/valyala/fasthttp v1.57.0 // indirect
|
||||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
golang.org/x/sys v0.24.0 // indirect
|
golang.org/x/sys v0.28.0 // indirect
|
||||||
)
|
)
|
||||||
|
26
go.sum
26
go.sum
@ -1,21 +1,27 @@
|
|||||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||||
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd h1:MsTk4yo6KVYdulsDscuH4AwiZN1CyuCJAg59EWE7HPQ=
|
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd h1:MsTk4yo6KVYdulsDscuH4AwiZN1CyuCJAg59EWE7HPQ=
|
||||||
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd/go.mod h1:vzEQfW+A1T+AMJmTIX+SXNLNECHOM7GEinHhw0IjykI=
|
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd/go.mod h1:vzEQfW+A1T+AMJmTIX+SXNLNECHOM7GEinHhw0IjykI=
|
||||||
|
github.com/bigkevmcd/go-configparser v0.0.0-20250311182818-a679eef33309 h1:h2H7P1M0rXm8LTJMhZWr3SAleTmR6vg+7PM1BkTumaw=
|
||||||
|
github.com/bigkevmcd/go-configparser v0.0.0-20250311182818-a679eef33309/go.mod h1:vzEQfW+A1T+AMJmTIX+SXNLNECHOM7GEinHhw0IjykI=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
|
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
|
||||||
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||||
|
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
|
||||||
|
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
|
||||||
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
|
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
|
||||||
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
|
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
|
||||||
github.com/gofiber/template/html/v2 v2.1.2 h1:wkK/mYJ3nIhongTkG3t0QgV4ADdgOYJYVSAF2AHnh8Y=
|
github.com/gofiber/template/html/v2 v2.1.2 h1:wkK/mYJ3nIhongTkG3t0QgV4ADdgOYJYVSAF2AHnh8Y=
|
||||||
github.com/gofiber/template/html/v2 v2.1.2/go.mod h1:E98Z/FzvpaSib06aWEgYk6GXNf3ctoyaJH8yW5ay5ak=
|
github.com/gofiber/template/html/v2 v2.1.2/go.mod h1:E98Z/FzvpaSib06aWEgYk6GXNf3ctoyaJH8yW5ay5ak=
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o=
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.3/go.mod h1:U5Fxgc5KpyujU9OqKzy6Kn6Qup6Tm7zdsISR+VpnHRE=
|
||||||
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
|
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
|
||||||
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
|
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||||
@ -36,14 +42,18 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
|
|||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
|
github.com/valyala/fasthttp v1.57.0 h1:Xw8SjWGEP/+wAAgyy5XTvgrWlOD1+TxbbvNADYCm1Tg=
|
||||||
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
|
github.com/valyala/fasthttp v1.57.0/go.mod h1:h6ZBaPRlzpZ6O3H5t2gEk1Qi33+TmLvfwgLLp0t9CpE=
|
||||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||||
|
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||||
|
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
|
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
Interval int `json:"interval"`
|
||||||
Pools []Pool `json:"pools"`
|
Pools []Pool `json:"pools"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,15 +20,13 @@ func (c *Config) Load(list *[]Package, file string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default config values
|
||||||
|
c.Interval = 5
|
||||||
|
c.Pools = []Pool{}
|
||||||
|
|
||||||
if err = json.Unmarshal(content, c); err != nil {
|
if err = json.Unmarshal(content, c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range c.Pools {
|
|
||||||
if err = p.Load(list); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
35
main.go
35
main.go
@ -35,29 +35,42 @@ type tracker struct {
|
|||||||
Config lib.Config
|
Config lib.Config
|
||||||
Last time.Time
|
Last time.Time
|
||||||
List []lib.Package
|
List []lib.Package
|
||||||
Tick time.Ticker
|
Tick *time.Ticker
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tracker) Reload() error {
|
func (t *tracker) Reload() error {
|
||||||
t.List = []lib.Package{}
|
t.List = []lib.Package{}
|
||||||
err := t.Config.Load(&t.List, "config.json")
|
|
||||||
t.Last = time.Now()
|
t.Last = time.Now()
|
||||||
|
|
||||||
|
for _, p := range t.Config.Pools {
|
||||||
|
if err := p.Load(&t.List); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (t *tracker) Loop() {
|
func (t *tracker) Loop() {
|
||||||
var err error
|
if err := t.Config.Load(&t.List, "config.json"); err != nil {
|
||||||
|
log.Error("Failed to load the configuration: %s", err.Error())
|
||||||
if err = t.Reload(); err != nil {
|
return
|
||||||
log.Error("Failed to update packages: %s", err.Error())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := t.Reload(); err != nil {
|
||||||
|
log.Error("Failed to update packages: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Tick = time.NewTicker(time.Minute * time.Duration(t.Config.Interval))
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-t.Tick.C:
|
case <-t.Tick.C:
|
||||||
if err = t.Reload(); err != nil {
|
if err := t.Reload(); err != nil {
|
||||||
log.Error("Failed to update packages: %s", err.Error())
|
log.Error("Failed to update packages: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-t.Channel:
|
case <-t.Channel:
|
||||||
t.Tick.Stop()
|
t.Tick.Stop()
|
||||||
return
|
return
|
||||||
@ -72,14 +85,13 @@ func (t *tracker) Stop() {
|
|||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
tracker tracker
|
tracker tracker
|
||||||
engine *html.Engine
|
|
||||||
app *fiber.App
|
app *fiber.App
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
engine = html.New("./templates", ".html")
|
|
||||||
app = fiber.New(fiber.Config{
|
app = fiber.New(fiber.Config{
|
||||||
DisableStartupMessage: true,
|
DisableStartupMessage: true,
|
||||||
Views: engine,
|
Views: html.New("./templates", ".html"),
|
||||||
})
|
})
|
||||||
|
|
||||||
app.Static("/", "./public")
|
app.Static("/", "./public")
|
||||||
@ -102,8 +114,7 @@ func main() {
|
|||||||
|
|
||||||
log.Info("Starting MatterLinux package tracker on port 9877")
|
log.Info("Starting MatterLinux package tracker on port 9877")
|
||||||
|
|
||||||
err := app.Listen(":9877")
|
if err = app.Listen(":9877"); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Error("Error starting server: %s", err.Error())
|
log.Error("Error starting server: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
renovate.json
Normal file
4
renovate.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": ["config:recommended"],
|
||||||
|
"prHourlyLimit": 20
|
||||||
|
}
|
Reference in New Issue
Block a user