Compare commits
No commits in common. "a310f7a9aa992fcc64fea927f06fd844343f9e5c" and "12e3b0c2d48ea4b58cb4a81f2c25e5d7243e1ad3" have entirely different histories.
a310f7a9aa
...
12e3b0c2d4
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,2 @@
|
|||||||
docker-compose.yml
|
|
||||||
compose.yml
|
|
||||||
content
|
content
|
||||||
website
|
website
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
FROM golang:1.22.5
|
FROM golang:1.21.4
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY *.go ./
|
COPY *.go ./
|
||||||
COPY *.mod ./
|
COPY *.mod ./
|
||||||
COPY *.sum ./
|
COPY *.sum ./
|
||||||
|
|
||||||
COPY log ./log
|
|
||||||
COPY lib ./lib
|
COPY lib ./lib
|
||||||
COPY routes ./routes
|
COPY routes ./routes
|
||||||
COPY public ./public
|
COPY public ./public
|
||||||
|
13
Makefile
13
Makefile
@ -1,13 +0,0 @@
|
|||||||
all: website
|
|
||||||
|
|
||||||
website: */*.go *.go
|
|
||||||
go build -o $@
|
|
||||||
|
|
||||||
format:
|
|
||||||
gofmt -s -w .
|
|
||||||
|
|
||||||
update:
|
|
||||||
go get -u
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
.PHONY: format update
|
|
25
README.md
25
README.md
@ -1,33 +1,18 @@
|
|||||||
# website | MatterLinux website
|
# website | MatterLinux Website
|
||||||
Soruce code of Matterlinux's offical website, which is
|
Soruce code of Matterlinux's offical website, which is
|
||||||
located at [matterlinux.xyz](https://matterlinux.xyz)
|
located at [matterlinux.xyz](https://matterlinux.xyz)
|
||||||
|
|
||||||
### Deployment
|
### Deployment
|
||||||
Web server can be built and deployed with docker compose using the following
|
Web server can be built and deployed with docker:
|
||||||
configuration file:
|
|
||||||
```yaml
|
|
||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
|
||||||
website:
|
|
||||||
image: matterwebsite
|
|
||||||
restart: unless-stopped
|
|
||||||
build:
|
|
||||||
context: ./
|
|
||||||
ports:
|
|
||||||
- "127.0.0.1:9878:9878"
|
|
||||||
volumes:
|
|
||||||
- "./content:/app/content"
|
|
||||||
```
|
```
|
||||||
After saving the configuration file, you can build and run the docker container:
|
docker build --tag matterwebsite .
|
||||||
```bash
|
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
### Managing content
|
### Managing Content
|
||||||
Website content can be managed by editing JSON and markdown files
|
Website content can be managed by editing JSON and markdown files
|
||||||
under the `content` direcotry.
|
under the `content` direcotry.
|
||||||
|
|
||||||
MatterLinux's website content directory can be found in the
|
Matterlinux's website content directory can be found in the
|
||||||
[content](https://git.matterlinux.xyz/Matter/content)
|
[content](https://git.matterlinux.xyz/Matter/content)
|
||||||
repository.
|
repository.
|
||||||
|
10
compose.yml
Normal file
10
compose.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
website:
|
||||||
|
image: matterwebsite
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:9878:9878"
|
||||||
|
volumes:
|
||||||
|
- "./content:/app/content"
|
17
go.mod
17
go.mod
@ -1,27 +1,26 @@
|
|||||||
module git.matterlinux.xyz/Matter/website
|
module git.matterlinux.xyz/Matter/website
|
||||||
|
|
||||||
go 1.22.5
|
go 1.21.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd
|
github.com/gofiber/fiber/v2 v2.52.4
|
||||||
github.com/gofiber/fiber/v2 v2.52.5
|
github.com/gofiber/template/html/v2 v2.1.1
|
||||||
github.com/gofiber/template/html/v2 v2.1.2
|
|
||||||
github.com/gorilla/feeds v1.2.0
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0
|
github.com/russross/blackfriday/v2 v2.1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||||
|
github.com/bigkevmcd/go-configparser v0.0.0-20230427073640-c6b631f70126 // 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.8 // 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.15 // 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.52.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.19.0 // indirect
|
||||||
)
|
)
|
||||||
|
64
go.sum
64
go.sum
@ -1,56 +1,56 @@
|
|||||||
|
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
|
||||||
|
github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||||
github.com/bigkevmcd/go-configparser v0.0.0-20240808124832-fc81059ea0bd h1:MsTk4yo6KVYdulsDscuH4AwiZN1CyuCJAg59EWE7HPQ=
|
github.com/bigkevmcd/go-configparser v0.0.0-20230427073640-c6b631f70126 h1:uru++pUKoS/yYU3Ohq9VItZdK/cT7FFJH/UUjOlxc+s=
|
||||||
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-20230427073640-c6b631f70126/go.mod h1:zqqfbfnDeSdRs1WihmMjSbhb2Ptw8Jbus831xoqiIec=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/gofiber/fiber/v2 v2.51.0 h1:JNACcZy5e2tGApWB2QrRpenTWn0fq0hkFm6k0C86gKQ=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/gofiber/fiber/v2 v2.51.0/go.mod h1:xaQRZQJGqnKOQnbQw+ltvku3/h8QxvNi8o6JiJ7Ll0U=
|
||||||
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
|
github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM=
|
||||||
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||||
|
github.com/gofiber/template v1.8.2 h1:PIv9s/7Uq6m+Fm2MDNd20pAFFKt5wWs7ZBd8iV9pWwk=
|
||||||
|
github.com/gofiber/template v1.8.2/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
|
||||||
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.0.5 h1:BKLJ6Qr940NjntbGmpO3zVa4nFNGDCi/IfUiDB9OC20=
|
||||||
github.com/gofiber/template/html/v2 v2.1.2/go.mod h1:E98Z/FzvpaSib06aWEgYk6GXNf3ctoyaJH8yW5ay5ak=
|
github.com/gofiber/template/html/v2 v2.0.5/go.mod h1:RCF14eLeQDCSUPp0IGc2wbSSDv6yt+V54XB/+Unz+LM=
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.1 h1:QEy3O3EBkvwDthy5bXVGUseOyO6ldJoiDxlF4+MJiV8=
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.1/go.mod h1:2G0GHHOUx70C1LDncoBpe4T6maQbNa4x1CVNFW0wju0=
|
||||||
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.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||||
|
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
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/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc=
|
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
|
||||||
github.com/gorilla/feeds v1.2.0/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y=
|
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
|
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||||
|
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
|
||||||
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.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
||||||
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
|
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
|
||||||
|
github.com/valyala/fasthttp v1.52.0 h1:wqBQpxH71XW0e2g+Og4dzQM8pk34aFYlA1Ga8db7gU0=
|
||||||
|
github.com/valyala/fasthttp v1.52.0/go.mod h1:hf5C4QnVMkNXMspnsUlfM3WitlgYflyhHYoKol/szxQ=
|
||||||
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=
|
||||||
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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
|
@ -43,7 +43,7 @@ func ListContent(dir string) ([]Content, error) {
|
|||||||
res = append(res, subres...)
|
res = append(res, subres...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.HasSuffix(e.Name(), ".json") {
|
if(!strings.HasSuffix(e.Name(), ".json")) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ func GetContent(dir string, name string) (Content, error) {
|
|||||||
return res, errors.New("Cannot read markdown file: "+mdfile)
|
return res, errors.New("Cannot read markdown file: "+mdfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if json.Unmarshal(jsoncontent, &res) != nil {
|
if(json.Unmarshal(jsoncontent, &res)!= nil) {
|
||||||
return res, errors.New("Cannot parse JSON: "+jsonfile)
|
return res, errors.New("Cannot parse JSON: "+jsonfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
log/log.go
23
log/log.go
@ -1,23 +0,0 @@
|
|||||||
package log
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Log(p string, f string, args ...interface{}) {
|
|
||||||
now := time.Now()
|
|
||||||
nstr := now.Format("[02/01/06 15:04:05]")
|
|
||||||
|
|
||||||
fmt.Printf("%s -%s- ", nstr, p)
|
|
||||||
fmt.Printf(f, args...)
|
|
||||||
fmt.Println()
|
|
||||||
}
|
|
||||||
|
|
||||||
func Info(f string, args ...interface{}) {
|
|
||||||
Log("INFO", f, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Error(f string, args ...interface{}) {
|
|
||||||
Log("ERROR", f, args...)
|
|
||||||
}
|
|
34
main.go
34
main.go
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
* website | MatterLinux website
|
* website | MatterLinux Official Website
|
||||||
* MatterLinux 2023-2024 (https://matterlinux.xyz)
|
* MatterLinux 2023-2024 (https://matterlinux.xyz)
|
||||||
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -21,15 +21,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"git.matterlinux.xyz/Matter/website/lib"
|
"git.matterlinux.xyz/Matter/website/lib"
|
||||||
"git.matterlinux.xyz/Matter/website/log"
|
|
||||||
"git.matterlinux.xyz/Matter/website/routes"
|
"git.matterlinux.xyz/Matter/website/routes"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/template/html/v2"
|
"github.com/gofiber/template/html/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main(){
|
func main(){
|
||||||
var err error
|
log.SetFlags(log.Lshortfile | log.Ltime)
|
||||||
|
|
||||||
engine := html.New("./templates", ".html")
|
engine := html.New("./templates", ".html")
|
||||||
app := fiber.New(fiber.Config{
|
app := fiber.New(fiber.Config{
|
||||||
@ -39,28 +40,25 @@ func main() {
|
|||||||
app.Static("/", "./public")
|
app.Static("/", "./public")
|
||||||
app.Static("/assets", "./content/assets")
|
app.Static("/assets", "./content/assets")
|
||||||
|
|
||||||
app.Get("/", routes.GET_Index)
|
app.Get("/", routes.IndexRoute)
|
||||||
app.Get("/download", routes.GET_Download)
|
app.Get("/download", routes.DownloadRoute)
|
||||||
|
|
||||||
app.Get("/news", routes.GET_News)
|
app.Get("/news", routes.NewsRoute)
|
||||||
app.Get("/news/feed.atom", routes.GET_NewsFeed)
|
app.Get("/news/:id", routes.PostRoute)
|
||||||
app.Get("/news/feed.rss", routes.GET_NewsFeed)
|
|
||||||
app.Get("/news/feed.json", routes.GET_NewsFeed)
|
|
||||||
app.Get("/news/:id", routes.GET_New)
|
|
||||||
|
|
||||||
app.Get("/wiki", routes.GET_Wiki)
|
app.Get("/wiki", routes.WikiMainRoute)
|
||||||
app.Get("/wiki/:id", routes.GET_WikiPage)
|
app.Get("/wiki/:id", routes.WikiRoute)
|
||||||
|
|
||||||
app.Get("/hub", routes.GET_Configs)
|
app.Get("/hub", routes.ConfigsRoute)
|
||||||
app.Get("/hub/:name", routes.GET_Config)
|
app.Get("/hub/:id", routes.ConfigRoute)
|
||||||
|
|
||||||
app.Get("*", func(c *fiber.Ctx) error {
|
app.Get("*", func(c *fiber.Ctx) error {
|
||||||
return lib.RenderError(c, 404)
|
return lib.RenderError(c, 404)
|
||||||
})
|
})
|
||||||
|
|
||||||
log.Info("Starting MatterLinux website on port 9878")
|
log.Println("Starting MatterLinux Website on port 9878")
|
||||||
|
err := app.Listen(":9878")
|
||||||
if err = app.Listen(":9878"); err != nil {
|
if err != nil {
|
||||||
log.Error("Error starting server: %s", err.Error())
|
log.Fatalf("Error starting server: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,34 +11,27 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background: var(--dark-second);
|
background: var(--dark-second);
|
||||||
border: solid 1px var(--bright-second);
|
border: solid 1px var(--bright-main);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloads {
|
.downloads {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 8px;
|
gap: 5px;
|
||||||
}
|
|
||||||
|
|
||||||
.downloads a:first-child {
|
|
||||||
border-right: solid 1px var(--bright-third);
|
|
||||||
padding-right: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry h1 {
|
.entry h1 {
|
||||||
color: var(--bright-main);
|
color: var(--bright-main);
|
||||||
font-weight: 900;
|
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry a {
|
.entry a, .entry p {
|
||||||
color: var(--bright-second);
|
color: var(--bright-main);
|
||||||
text-decoration: none;
|
|
||||||
font-weight: 100;
|
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry a:hover {
|
.entry a:hover {
|
||||||
text-decoration: underline;
|
color: var(--bright-second);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
.md p {
|
.md p {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: var(--bright-second);
|
color: var(--bright-second);
|
||||||
line-height: 26px;
|
line-height: 24px;
|
||||||
letter-spacing: .01em;
|
letter-spacing: .01em;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
main {
|
main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-top: 40px;
|
padding-top: 50px;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,42 +11,6 @@ main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.feed-menu {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
color: white;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feed-menu p {
|
|
||||||
color: var(--bright-main);
|
|
||||||
border-right: solid 1px var(--bright-third);
|
|
||||||
padding-right: 8px;
|
|
||||||
font-weight: 900;
|
|
||||||
font-size: 17px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feed-menu .feeds {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feed-menu .feeds a {
|
|
||||||
font-weight: 100;
|
|
||||||
font-size: 16px;
|
|
||||||
color: var(--bright-second);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feed-menu .feeds a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small {
|
.small {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
.subtext {
|
.subtext {
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
margin: 12px 0 15px 0;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subtext p {
|
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: var(--bright-main);
|
color: var(--bright-main);
|
||||||
}
|
margin: 5px 0 15px 0;
|
||||||
|
|
||||||
.subtext p:first-child {
|
|
||||||
border-right: solid 1px var(--bright-third);
|
|
||||||
padding-right: 8px;
|
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.matterlinux.xyz/Matter/website/lib"
|
"git.matterlinux.xyz/Matter/website/lib"
|
||||||
"git.matterlinux.xyz/Matter/website/log"
|
|
||||||
"github.com/bigkevmcd/go-configparser"
|
"github.com/bigkevmcd/go-configparser"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
@ -25,7 +25,7 @@ type Config struct {
|
|||||||
Keywords string
|
Keywords string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) Load() error {
|
func LoadConfig(c *Config) (error) {
|
||||||
agent := fiber.Get(c.Url)
|
agent := fiber.Get(c.Url)
|
||||||
code, body, errs := agent.Bytes()
|
code, body, errs := agent.Bytes()
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
@ -64,10 +64,10 @@ func (c *Config) Load() error {
|
|||||||
c.Author = author
|
c.Author = author
|
||||||
c.Keywords = strings.ReplaceAll(keywords, ",", ", ")
|
c.Keywords = strings.ReplaceAll(keywords, ",", ", ")
|
||||||
|
|
||||||
if !lib.IsStringValid(c.Name) ||
|
if(!lib.IsStringValid(c.Name) ||
|
||||||
!lib.IsStringValid(c.Desc) ||
|
!lib.IsStringValid(c.Desc) ||
|
||||||
!lib.IsStringValid(c.Author) ||
|
!lib.IsStringValid(c.Author) ||
|
||||||
!lib.IsStringValid(c.Keywords) {
|
!lib.IsStringValid(c.Keywords)){
|
||||||
return fmt.Errorf("keywords or name contain illegal chars: %s", c.Url)
|
return fmt.Errorf("keywords or name contain illegal chars: %s", c.Url)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,8 @@ func GetConfigs() ([]Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i := range data["list"] {
|
for i := range data["list"] {
|
||||||
if err = data["list"][i].Load(); err != nil {
|
err = LoadConfig(&data["list"][i])
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,20 +102,16 @@ func GetConfigs() ([]Config, error) {
|
|||||||
return data["list"], nil
|
return data["list"], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GET_Configs(c *fiber.Ctx) error {
|
func ConfigsRoute(c *fiber.Ctx) error{
|
||||||
var (
|
con, err := lib.GetContent("", "configs")
|
||||||
err error
|
if err != nil {
|
||||||
con lib.Content
|
log.Printf("GetContent failed: %s", err.Error())
|
||||||
configs []Config
|
|
||||||
)
|
|
||||||
|
|
||||||
if con, err = lib.GetContent("", "configs"); err != nil {
|
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
if configs, err = GetConfigs(); err != nil {
|
configs, err := GetConfigs()
|
||||||
log.Error("GetConfigs failed: %s", err.Error())
|
if err != nil {
|
||||||
|
log.Printf("GetConfigs failed: %s", err.Error())
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,25 +121,6 @@ func GET_Configs(c *fiber.Ctx) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func GET_Config(c *fiber.Ctx) error {
|
func ConfigRoute(c *fiber.Ctx) error{
|
||||||
var (
|
return c.Redirect("/configs")
|
||||||
err error
|
|
||||||
name string
|
|
||||||
configs []Config
|
|
||||||
)
|
|
||||||
|
|
||||||
name = c.Params("name")
|
|
||||||
|
|
||||||
if configs, err = GetConfigs(); err != nil {
|
|
||||||
log.Error("GetConfigs failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, cur := range configs {
|
|
||||||
if cur.Name == name || cur.Name+".git" == name {
|
|
||||||
return c.Status(301).Redirect(cur.Redirect)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return lib.RenderError(c, 404)
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
package routes
|
package routes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"git.matterlinux.xyz/Matter/website/lib"
|
"git.matterlinux.xyz/Matter/website/lib"
|
||||||
"git.matterlinux.xyz/Matter/website/log"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GET_Download(c *fiber.Ctx) error {
|
func DownloadRoute(c *fiber.Ctx) error{
|
||||||
var (
|
con, err := lib.GetContent("", "download")
|
||||||
con lib.Content
|
if err != nil {
|
||||||
err error
|
log.Printf("GetContent failed: %s", err.Error())
|
||||||
)
|
|
||||||
|
|
||||||
if con, err = lib.GetContent("", "download"); err != nil {
|
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
package routes
|
package routes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"git.matterlinux.xyz/Matter/website/lib"
|
"git.matterlinux.xyz/Matter/website/lib"
|
||||||
"git.matterlinux.xyz/Matter/website/log"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GET_Index(c *fiber.Ctx) error {
|
func IndexRoute(c *fiber.Ctx) error{
|
||||||
var (
|
con, err := lib.GetContent("", "index")
|
||||||
err error
|
if err != nil {
|
||||||
con lib.Content
|
log.Printf("GetContent failed: %s", err.Error())
|
||||||
)
|
|
||||||
|
|
||||||
if con, err = lib.GetContent("", "index"); err != nil {
|
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
118
routes/news.go
118
routes/news.go
@ -1,60 +1,42 @@
|
|||||||
package routes
|
package routes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
"path"
|
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.matterlinux.xyz/Matter/website/lib"
|
"git.matterlinux.xyz/Matter/website/lib"
|
||||||
"git.matterlinux.xyz/Matter/website/log"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gorilla/feeds"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetContent() ([]lib.Content, error) {
|
func NewsRoute(c *fiber.Ctx) error {
|
||||||
var (
|
contents, err := lib.ListContent("news")
|
||||||
contents []lib.Content
|
if err != nil {
|
||||||
err error
|
log.Printf("ListContent failed: %s", err.Error())
|
||||||
)
|
return lib.RenderError(c, 500)
|
||||||
|
|
||||||
if contents, err = lib.ListContent("news"); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(contents, func(i, j int) bool {
|
sort.Slice(contents, func(i, j int) bool {
|
||||||
time1, err := lib.TimeFromString(contents[i].Date)
|
time1, err := lib.TimeFromString(contents[i].Date)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Bad date while sorting: %s", err.Error())
|
log.Printf("Bad date while sorting: %s", err.Error())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
time2, err := lib.TimeFromString(contents[j].Date)
|
time2, err := lib.TimeFromString(contents[j].Date)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Bad date while sorting: %s", err.Error())
|
log.Printf("Bad date while sorting: %s", err.Error())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return time1.After(time2)
|
return time1.After(time2)
|
||||||
})
|
})
|
||||||
|
|
||||||
return contents, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GET_News(c *fiber.Ctx) error {
|
|
||||||
contents, err := GetContent()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.Render("news", fiber.Map{
|
return c.Render("news", fiber.Map{
|
||||||
"news": contents,
|
"news": contents,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func GET_New(c *fiber.Ctx) error {
|
func PostRoute(c *fiber.Ctx) error {
|
||||||
postid := c.Params("id")
|
postid := c.Params("id")
|
||||||
if len(postid) == 0 {
|
if len(postid) == 0 {
|
||||||
return lib.RenderError(c, 404)
|
return lib.RenderError(c, 404)
|
||||||
@ -62,18 +44,18 @@ func GET_New(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
contents, err := lib.ListContent("news")
|
contents, err := lib.ListContent("news")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("ListContent failed: %s", err.Error())
|
log.Printf("ListContent failed: %s", err.Error())
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, con := range contents {
|
for _, con := range contents {
|
||||||
if con.ID != postid {
|
if(con.ID != postid) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
con, err = lib.GetContent(con.Dir, con.Name)
|
con, err = lib.GetContent(con.Dir, con.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("ListContent failed: %s", err.Error())
|
log.Printf("ListContent failed: %s", err.Error())
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,79 +67,3 @@ func GET_New(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
return lib.RenderError(c, 404)
|
return lib.RenderError(c, 404)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GET_NewsFeed(c *fiber.Ctx) error {
|
|
||||||
var (
|
|
||||||
feed_type string
|
|
||||||
feed *feeds.Feed
|
|
||||||
contents []lib.Content
|
|
||||||
res string
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
feed_type = path.Base(c.Path())
|
|
||||||
|
|
||||||
if contents, err = GetContent(); err != nil {
|
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
feed = &feeds.Feed{
|
|
||||||
Title: "MatterLinux | News",
|
|
||||||
Link: &feeds.Link{Href: "https://matterlinux.xyz/news"}, // lets hardcode this for now
|
|
||||||
Description: "News regarding the MatterLinux project",
|
|
||||||
Created: time.Now(),
|
|
||||||
}
|
|
||||||
|
|
||||||
feed.Items = []*feeds.Item{}
|
|
||||||
|
|
||||||
for _, con := range contents {
|
|
||||||
parsed, err := time.Parse("02/01/06", con.Date)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Failed to parse post time (%s): %s", con.ID, err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
feed.Items = append(feed.Items, &feeds.Item{
|
|
||||||
Id: con.ID,
|
|
||||||
Title: con.Title,
|
|
||||||
Link: &feeds.Link{Href: fmt.Sprintf("https://matterlinux.xyz/news/%s", con.ID)},
|
|
||||||
Author: &feeds.Author{Name: con.Author},
|
|
||||||
Created: parsed,
|
|
||||||
Content: con.Md,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
switch feed_type {
|
|
||||||
case "feed.atom":
|
|
||||||
if res, err = feed.ToAtom(); err != nil {
|
|
||||||
log.Error("Failed to convert feed to atom: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Set("Content-Type", "application/atom+xml")
|
|
||||||
return c.Send([]byte(res))
|
|
||||||
|
|
||||||
case "feed.rss":
|
|
||||||
if res, err = feed.ToRss(); err != nil {
|
|
||||||
log.Error("Failed to convert feed to RSS: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Set("Content-Type", "application/rss+xml")
|
|
||||||
return c.Send([]byte(res))
|
|
||||||
|
|
||||||
case "feed.json":
|
|
||||||
if res, err = feed.ToJSON(); err != nil {
|
|
||||||
log.Error("Failed to convert feed to JSON: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Set("Content-Type", "application/feed+json")
|
|
||||||
return c.Send([]byte(res))
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Error("Cannot handle the feed type: %s", feed_type)
|
|
||||||
return lib.RenderError(c, 404)
|
|
||||||
}
|
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
package routes
|
package routes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"git.matterlinux.xyz/Matter/website/lib"
|
"git.matterlinux.xyz/Matter/website/lib"
|
||||||
"git.matterlinux.xyz/Matter/website/log"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GET_Wiki(c *fiber.Ctx) error {
|
func WikiMainRoute(c *fiber.Ctx) error {
|
||||||
var (
|
con, err := lib.GetContent("wiki", "main")
|
||||||
con lib.Content
|
if err != nil {
|
||||||
err error
|
log.Printf("GetContent failed: %s", err.Error())
|
||||||
)
|
|
||||||
|
|
||||||
if con, err = lib.GetContent("wiki", "main"); err != nil {
|
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,35 +20,30 @@ func GET_Wiki(c *fiber.Ctx) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func GET_WikiPage(c *fiber.Ctx) error {
|
func WikiRoute(c *fiber.Ctx) error{
|
||||||
var (
|
|
||||||
contents []lib.Content
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
docid := c.Params("id")
|
docid := c.Params("id")
|
||||||
if len(docid) == 0 {
|
if len(docid) == 0 {
|
||||||
return lib.RenderError(c, 404)
|
return lib.RenderError(c, 404)
|
||||||
}
|
}
|
||||||
|
|
||||||
if contents, err = lib.ListContent("wiki"); err != nil {
|
contents, err := lib.ListContent("wiki")
|
||||||
log.Error("ListContent failed: %s", err.Error())
|
if err != nil {
|
||||||
|
log.Printf("ListContent failed: %s", err.Error())
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, con := range contents {
|
for _, con := range contents {
|
||||||
if con.ID != docid {
|
if(con.ID != docid) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
con, err = lib.GetContent(con.Dir, con.Name)
|
con, err = lib.GetContent(con.Dir, con.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("GetContent failed: %s", err.Error())
|
log.Printf("GetContent failed: %s", err.Error())
|
||||||
return lib.RenderError(c, 500)
|
return lib.RenderError(c, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
con.Title = "Wiki: "+con.Title
|
con.Title = "Wiki: "+con.Title
|
||||||
|
|
||||||
return c.Render("post", fiber.Map{
|
return c.Render("post", fiber.Map{
|
||||||
"title": con.Title,
|
"title": con.Title,
|
||||||
"post": con,
|
"post": con,
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>MatterLinux | Configs</title>
|
<title>MatterLinux | Configs</title>
|
||||||
{{template "parts/head" .}}
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=1200">
|
||||||
|
<link href="/global.css" rel="stylesheet">
|
||||||
<link href="/configs.css" rel="stylesheet">
|
<link href="/configs.css" rel="stylesheet">
|
||||||
<link href="/md.css" rel="stylesheet">
|
<link href="/md.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
@ -43,7 +45,7 @@
|
|||||||
Run the following to install this
|
Run the following to install this
|
||||||
confiugraiton:
|
confiugraiton:
|
||||||
</p>
|
</p>
|
||||||
<pre>$ confer pull {{.Name}}</pre>
|
<pre>$ mc-pull {{.Name}}</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>MatterLinux | Download</title>
|
<title>MatterLinux | Download</title>
|
||||||
{{template "parts/head" .}}
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=1200">
|
||||||
|
<link href="/global.css" rel="stylesheet">
|
||||||
<link href="/download.css" rel="stylesheet">
|
<link href="/download.css" rel="stylesheet">
|
||||||
<link href="/md.css" rel="stylesheet">
|
<link href="/md.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
@ -10,21 +12,27 @@
|
|||||||
{{template "parts/bar" .}}
|
{{template "parts/bar" .}}
|
||||||
<main>
|
<main>
|
||||||
<div class="md">
|
<div class="md">
|
||||||
<h1>Download MatterLinux {{.content.ID}}</h1>
|
<h1>Download MatterLinux</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h1>Archive</h1>
|
<h1>Version</h1>
|
||||||
|
<h1>{{.content.ID}}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="entry">
|
||||||
|
<h1>Release Archive</h1>
|
||||||
<div class="downloads">
|
<div class="downloads">
|
||||||
<a href="https://rel.matterlinux.xyz/{{.content.Title}}/matterlinux_{{.content.ID}}.tar.gz">Download</a>
|
<a href="https://rel.matterlinux.xyz/{{.contentTitle}}/matterlinux_{{.content.ID}}.tar.gz">Download</a>
|
||||||
<a href="https://rel.matterlinux.xyz/{{.content.Title}}/matterlinux_{{.content.ID}}.tar.gz.sig">Signature</a>
|
<p>|</p>
|
||||||
|
<a href="https://rel.matterlinux.xyz/{{.contentTitle}}/matterlinux_{{.content.ID}}.tar.gz.sig">Signature</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h1>ISO</h1>
|
<h1>Release ISO</h1>
|
||||||
<div class="downloads">
|
<div class="downloads">
|
||||||
<a href="https://rel.matterlinux.xyz/{{.content.Title}}/matterlinux_{{.content.ID}}.iso">Download</a>
|
<a href="https://rel.matterlinux.xyz/{{.contentTitle}}/matterlinux_{{.content.ID}}.iso">Download</a>
|
||||||
<a href="https://rel.matterlinux.xyz/{{.content.Title}}/matterlinux_{{.content.ID}}.iso.sig">Signature</a>
|
<p>|</p>
|
||||||
|
<a href="https://rel.matterlinux.xyz/{{.contentTitle}}/matterlinux_{{.content.ID}}.iso.sig">Signature</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>MatterLinux | Error</title>
|
<title>MatterLinux | Error</title>
|
||||||
{{template "parts/head" .}}
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=1200">
|
||||||
|
<link href="/global.css" rel="stylesheet">
|
||||||
<link href="/error.css" rel="stylesheet">
|
<link href="/error.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>MatterLinux</title>
|
<title>MatterLinux</title>
|
||||||
{{template "parts/head" .}}
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=1200">
|
||||||
|
<link href="/global.css" rel="stylesheet">
|
||||||
<link href="/md.css" rel="stylesheet">
|
<link href="/md.css" rel="stylesheet">
|
||||||
<link href="/index.css" rel="stylesheet">
|
<link href="/index.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
@ -2,22 +2,14 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>MatterLinux | News</title>
|
<title>MatterLinux | News</title>
|
||||||
{{template "parts/head" .}}
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=1200">
|
||||||
|
<link href="/global.css" rel="stylesheet">
|
||||||
<link href="/news.css" rel="stylesheet">
|
<link href="/news.css" rel="stylesheet">
|
||||||
<link rel="alternate" type="application/atom+xml" href="/news/feed.atom" title="Atom Feed">
|
|
||||||
<link rel="alternate" type="application/rss+xml" href="/news/feed.rss" title="RSS Feed">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{template "parts/bar" .}}
|
{{template "parts/bar" .}}
|
||||||
<main>
|
<main>
|
||||||
<div class="feed-menu">
|
|
||||||
<p>Feeds</p>
|
|
||||||
<div class="feeds">
|
|
||||||
<a href="/news/feed.atom">Atom</a>
|
|
||||||
<a href="/news/feed.rss">RSS</a>
|
|
||||||
<a href="/news/feed.json">JSON</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{range .news}}
|
{{range .news}}
|
||||||
<a href="/news/{{.ID}}" class="small">
|
<a href="/news/{{.ID}}" class="small">
|
||||||
<h1>{{.Date}}</h1>
|
<h1>{{.Date}}</h1>
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=1200">
|
|
||||||
<link href="/global.css" rel="stylesheet">
|
|
@ -2,7 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>MatterLinux | {{.title}}</title>
|
<title>MatterLinux | {{.title}}</title>
|
||||||
{{template "parts/head" .}}
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=1200">
|
||||||
|
<link href="/global.css" rel="stylesheet">
|
||||||
<link href="/post.css" rel="stylesheet">
|
<link href="/post.css" rel="stylesheet">
|
||||||
<link href="/md.css" rel="stylesheet">
|
<link href="/md.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
@ -12,10 +14,7 @@
|
|||||||
<div class="md">
|
<div class="md">
|
||||||
<h1>{{.post.Title}}</h1>
|
<h1>{{.post.Title}}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="subtext">
|
<p class="subtext">{{.post.Date}} | by {{.post.Author}}</p>
|
||||||
<p class="date">{{.post.Date}}</p>
|
|
||||||
<p class="author">by {{.post.Author}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="md">
|
<div class="md">
|
||||||
{{.post.HTML}}
|
{{.post.HTML}}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user