diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5eccfc2..db948b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,15 +4,34 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v2 + - uses: actions/checkout@v6 with: - node-version: "16" - - uses: actions/checkout@v2.3.1 - - run: (cd website && npm ci) - - run: (cd website && npm run format:test) - - run: (cd website && npm run build) - - uses: JamesIves/github-pages-deploy-action@4.1.4 - if: github.ref == 'refs/heads/master' + fetch-depth: 0 + - uses: actions/setup-node@v6 with: - branch: gh-pages - folder: website/build/website + node-version: 25 + cache: yarn + cache-dependency-path: yarn.lock + - run: yarn install --frozen-lockfile + - run: yarn format:test + - run: yarn build + - uses: actions/configure-pages@v5 + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + - uses: actions/upload-pages-artifact@v3 + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + with: + path: .vitepress/dist + deploy: + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index f78db3c..c2edd9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,5 @@ .DS_Store - node_modules .idea - -lib/core/metadata.js -lib/core/MetadataBlog.js - -website/translated_docs -website/build/ -website/yarn.lock -website/node_modules -website/i18n/* +.vitepress/cache +.vitepress/dist diff --git a/.vitepress/config.ts b/.vitepress/config.ts new file mode 100644 index 0000000..a7ad1ef --- /dev/null +++ b/.vitepress/config.ts @@ -0,0 +1,79 @@ +import {defineConfig} from 'vitepress'; + +export default defineConfig({ + lang: 'en-US', + title: 'Gotify', + description: 'a simple server for sending and receiving messages', + sitemap: {hostname: 'https://gotify.net'}, + + cleanUrls: true, + lastUpdated: true, + srcExclude: ['README.md'], + + head: [['link', {rel: 'icon', type: 'image/png', href: '/img/favicon.png'}]], + + themeConfig: { + logo: '/img/logo.png', + externalLinkIcon: true, + search: {provider: 'local'}, + nav: [ + {text: 'Docs', link: '/docs/'}, + {text: 'API-Docs', link: '/api-docs'}, + ], + sidebar: { + '/docs/': [ + { + text: 'Getting Started', + items: [ + {text: 'Intro', link: '/docs/'}, + {text: 'Installation', link: '/docs/install'}, + {text: 'Configuration', link: '/docs/config'}, + {text: 'First Login', link: '/docs/first-login'}, + {text: 'Push messages', link: '/docs/pushmsg'}, + {text: 'Message Extras', link: '/docs/msgextras'}, + ], + }, + { + text: 'REST-API', + items: [{text: 'Swagger Documentation', link: '/api-docs'}], + }, + { + text: 'Plugins', + items: [ + {text: 'Intro to Gotify Plugins', link: '/docs/plugin'}, + {text: 'Writing Plugins', link: '/docs/plugin-write'}, + {text: 'Building and Deploying Plugins', link: '/docs/plugin-deploy'}, + ], + }, + { + text: 'Development', + items: [ + {text: 'Setup Environment', link: '/docs/dev-setup'}, + {text: 'Servers and Tests', link: '/docs/dev-server-and-tests'}, + {text: 'Build Gotify', link: '/docs/build'}, + ], + }, + { + text: 'Miscellaneous', + items: [ + {text: 'Apache reverse proxy', link: '/docs/apache'}, + {text: 'Caddy 2 reverse proxy', link: '/docs/caddy'}, + {text: 'Haproxy reverse proxy', link: '/docs/haproxy'}, + {text: '(more) Push message examples', link: '/docs/more-pushmsg'}, + {text: 'nginx reverse proxy', link: '/docs/nginx'}, + {text: 'Optimize uploaded images', link: '/docs/optimize-images'}, + {text: 'systemd configuration', link: '/docs/systemd'}, + {text: 'Traefik reverse proxy', link: '/docs/traefik'}, + ], + }, + ], + }, + + editLink: { + pattern: 'https://github.com/gotify/website/tree/master/:path', + text: 'Edit this page on GitHub', + }, + + socialLinks: [{icon: 'github', link: 'https://github.com/gotify'}], + }, +}); diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts new file mode 100644 index 0000000..d050e52 --- /dev/null +++ b/.vitepress/theme/index.ts @@ -0,0 +1,4 @@ +import DefaultTheme from 'vitepress/theme'; +import './style.css'; + +export default DefaultTheme; diff --git a/.vitepress/theme/style.css b/.vitepress/theme/style.css new file mode 100644 index 0000000..8a668b5 --- /dev/null +++ b/.vitepress/theme/style.css @@ -0,0 +1,60 @@ +:root { + --vp-c-brand-1: #3498db; + --vp-c-brand-soft: rgba(52, 152, 219, 0.14); +} + +.dark { + --vp-c-brand-1: #5dade2; + --vp-c-brand-soft: rgba(52, 152, 219, 0.16); +} + +.project-section { + margin: 20px auto; + padding: 24px; + background-color: var(--vp-c-bg-soft); + display: flex; + align-items: center; + gap: 40px; +} + +.project-section.reverse { + flex-direction: row-reverse; +} + +.project-text { + flex: 1; +} + +.project-text h2 { + margin-top: 0; + border-top: none; + padding-top: 0; +} + +.project-text h2 a { + color: var(--vp-c-brand-1); +} + +.project-image { + flex: 1; +} + +.project-image img { + border-radius: 8px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); +} + +.store-badges p { + display: flex; +} +.store-badges img { + width: 150px; + margin-right: 8px; +} + +@media (max-width: 768px) { + .project-section, + .project-section.reverse { + flex-direction: column; + } +} diff --git a/api-docs-fetcher.ts b/api-docs-fetcher.ts new file mode 100644 index 0000000..8779ce6 --- /dev/null +++ b/api-docs-fetcher.ts @@ -0,0 +1,13 @@ +export const fetchUrls = async () => { + const res = await fetch('https://api.github.com/repos/gotify/server/tags', { + headers: {Accept: 'application/vnd.github.v3+json'}, + }); + if (!res.ok) { + throw Error('could not fetch tags'); + } + const tags: {name: string}[] = await res.json(); + return tags.map((tag) => ({ + url: `https://raw.githubusercontent.com/gotify/server/${tag.name}/docs/spec.json`, + name: tag.name, + })); +}; diff --git a/api-docs.data.ts b/api-docs.data.ts new file mode 100644 index 0000000..3b73d5f --- /dev/null +++ b/api-docs.data.ts @@ -0,0 +1,8 @@ +import {fetchUrls} from './api-docs-fetcher'; + +// This is evaluated at build-time: https://vitepress.dev/guide/data-loading +export default { + async load() { + return fetchUrls(); + }, +}; diff --git a/api-docs.md b/api-docs.md new file mode 100644 index 0000000..60ef74c --- /dev/null +++ b/api-docs.md @@ -0,0 +1,34 @@ +--- +layout: page +title: API Documentation +head: + - [link, {rel: stylesheet, href: /swagger/swagger-ui.css}] + - [script, {src: /swagger/swagger-ui-bundle.js}] + - [script, {src: /swagger/swagger-ui-standalone-preset.js}] +--- + +
+ + diff --git a/docs/apache.md b/docs/apache.md index 338939c..8467f93 100644 --- a/docs/apache.md +++ b/docs/apache.md @@ -1,7 +1,4 @@ ---- -id: apache -title: Apache reverse proxy ---- +# Apache reverse proxy Here are configuration examples for setting up apache as reverse proxy for gotify/server. diff --git a/docs/build.md b/docs/build.md index 26643d5..53259ad 100644 --- a/docs/build.md +++ b/docs/build.md @@ -1,7 +1,4 @@ ---- -id: build -title: Build Gotify ---- +# Build Gotify 1. [Setup development environment](dev-setup.md) diff --git a/docs/caddy.md b/docs/caddy.md index b9e8909..e72133e 100644 --- a/docs/caddy.md +++ b/docs/caddy.md @@ -1,11 +1,8 @@ ---- -id: caddy -title: Caddy 2 reverse proxy ---- +# Caddy 2 reverse proxy Setting up [Caddy](https://caddyserver.com) as a reverse proxy is very straightforward. Here are two config examples. -# As a standalone domain +## As a standalone domain Here is a sample config file if you run your gotify instance on port 1245 @@ -19,7 +16,7 @@ gotify.example.com { Caddy automatically deploys SSL certificates from Let's Encrypt for your domain. If you want to explicitly disable TLS encryption, prefix your server name with `http://`. -# At a subpath +## At a subpath Here is the equivalent of the sample config above but running under a sub path. diff --git a/docs/configuration.md b/docs/config.md similarity index 93% rename from docs/configuration.md rename to docs/config.md index 2c8b6bf..a4d46a8 100644 --- a/docs/configuration.md +++ b/docs/config.md @@ -1,7 +1,4 @@ ---- -id: config -title: Configuration ---- +# Configuration gotify/server can be configured per config file and environment variables. When using docker it is recommended to use environment variables. @@ -13,12 +10,14 @@ gotify/server looks in the following paths for config files - ./config.yml - /etc/gotify/config.yml -**Note**: When strings contain reserved yml characters then they need to be escaped. -[A list of reserved characters and how to escape them.](https://stackoverflow.com/a/22235064/4244993) +> [!note] +> When strings contain reserved yml characters then they need to be escaped. +> [A list of reserved characters and how to escape them.](https://stackoverflow.com/a/22235064/4244993) -**Note**: The config file `/etc/gotify/config.yml` can contain sensitive data -such as the initial admin password. When using it, you should remove read/write -rights from users not owning the file: +> [!note] +> The config file `/etc/gotify/config.yml` can contain sensitive data +> such as the initial admin password. When using it, you should remove read/write +> rights from users not owning the file: ```bash $ sudo chmod go-rw /etc/gotify/config.yml diff --git a/docs/dev-server-and-tests.md b/docs/dev-server-and-tests.md index 9adaaaf..4accd55 100644 --- a/docs/dev-server-and-tests.md +++ b/docs/dev-server-and-tests.md @@ -1,7 +1,4 @@ ---- -id: dev-server-and-tests -title: Servers and Tests ---- +# Servers and Tests ## Start development servers @@ -36,7 +33,7 @@ The UI requires a Gotify server running on `localhost:80`. This can be adjusted ## Update Swagger spec -The [gotify/server REST-API](swagger-docs.md) is documented via Swagger. The Swagger definition is generated via source code comments +The [gotify/server REST-API](/api-docs) is documented via Swagger. The Swagger definition is generated via source code comments ([example comment](https://github.com/gotify/server/blob/09c1516a170dfb47d29644db622655b540b94922/api/application.go#L33)). After changing such a source code comment, you can run the following command to update the Swagger definition. diff --git a/docs/dev-setup.md b/docs/dev-setup.md index 3376878..aa0d2fc 100644 --- a/docs/dev-setup.md +++ b/docs/dev-setup.md @@ -1,7 +1,4 @@ ---- -id: dev-setup -title: Setup Environment ---- +# Setup Environment Gotify requires: diff --git a/docs/first-login.md b/docs/first-login.md index f1fa0c4..0169cf3 100644 --- a/docs/first-login.md +++ b/docs/first-login.md @@ -1,7 +1,4 @@ ---- -id: first-login -title: First Login ---- +# First Login After setting up gotify/server you can login to the WebUI. When first launched an initial account is created so you can log in. If you have not overriden the defaults in the configuration, use username: `admin` password: `admin`. diff --git a/docs/haproxy.md b/docs/haproxy.md index 14fbb75..7cbda48 100644 --- a/docs/haproxy.md +++ b/docs/haproxy.md @@ -1,13 +1,10 @@ ---- -id: haproxy -title: Haproxy reverse proxy ---- +# Haproxy reverse proxy Here are configuration examples for setting up Haproxy as reverse proxy for gotify/server. ## Proxy requests -```haproxy +```txt frontend www bind 0.0.0.0:80 default_backend backend_gotify diff --git a/docs/index.md b/docs/index.md index d2a14dc..b4d4176 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,4 @@ ---- -id: index -title: Intro ---- +# Intro This is the documentation of gotify/server. Lets start with some definitions: @@ -14,4 +11,4 @@ Users are only able to manage (view/edit/delete) clients and applications (inclu A message has the following attributes: content, title, creation date, application id and priority. - + diff --git a/docs/installation.md b/docs/install.md similarity index 91% rename from docs/installation.md rename to docs/install.md index 63f375a..45f11eb 100644 --- a/docs/installation.md +++ b/docs/install.md @@ -1,13 +1,10 @@ ---- -id: install -title: Installation ---- +# Installation ## Docker Setting up gotify/server with docker is pretty easy, you basically just have to start the docker container and you are ready to go: -Before starting gotify/server you may read the [Configuration](configuration.md) if you f.ex. use a different database. +Before starting gotify/server you may read the [Configuration](config.md) if you f.ex. use a different database. ```bash $ docker run -p 80:80 -v /var/gotify/data:/app/data gotify/server @@ -29,8 +26,7 @@ The time zone inside the container is configurable via the `TZ` environment vari $ docker run -p 80:80 -e TZ="Europe/Berlin" -v /var/gotify/data:/app/data gotify/server ``` -+::: details Example docker-compose.yaml ```yml --- @@ -48,8 +44,7 @@ services: # user: "1234:1234" ``` -
-