Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
79 changes: 79 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -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'}],
},
});
4 changes: 4 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import DefaultTheme from 'vitepress/theme';
import './style.css';

export default DefaultTheme;
60 changes: 60 additions & 0 deletions .vitepress/theme/style.css
Original file line number Diff line number Diff line change
@@ -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;
}
}
13 changes: 13 additions & 0 deletions api-docs-fetcher.ts
Original file line number Diff line number Diff line change
@@ -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,
}));
};
8 changes: 8 additions & 0 deletions api-docs.data.ts
Original file line number Diff line number Diff line change
@@ -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();
},
};
34 changes: 34 additions & 0 deletions api-docs.md
Original file line number Diff line number Diff line change
@@ -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}]
---

<div id="swagger-ui"></div>

<script setup>
import { data as urls } from './api-docs.data.ts'
import { onMounted } from 'vue'
import { fetchUrls } from './api-docs-fetcher.ts'

onMounted(() => {
fetchUrls()
.catch((e) => {
console.log("Failed to load tags", e)
return urls;
})
.then(urls => {
window.SwaggerUIBundle({
urls,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [window.SwaggerUIBundle.presets.apis, window.SwaggerUIStandalonePreset],
plugins: [window.SwaggerUIBundle.plugins.DownloadUrl],
layout: 'StandaloneLayout',
})
})
})
</script>
5 changes: 1 addition & 4 deletions docs/apache.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 1 addition & 4 deletions docs/build.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: build
title: Build Gotify
---
# Build Gotify

1. [Setup development environment](dev-setup.md)

Expand Down
9 changes: 3 additions & 6 deletions docs/caddy.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.

Expand Down
17 changes: 8 additions & 9 deletions docs/configuration.md → docs/config.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
7 changes: 2 additions & 5 deletions docs/dev-server-and-tests.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: dev-server-and-tests
title: Servers and Tests
---
# Servers and Tests

## Start development servers

Expand Down Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions docs/dev-setup.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
id: dev-setup
title: Setup Environment
---
# Setup Environment

Gotify requires:

Expand Down
5 changes: 1 addition & 4 deletions docs/first-login.md
Original file line number Diff line number Diff line change
@@ -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`.

Expand Down
7 changes: 2 additions & 5 deletions docs/haproxy.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading