Skip to content

Commit 34a7e47

Browse files
authored
Merge pull request #99 from gotify/vitepress
Migrate to vitepress
2 parents 66d48e2 + e78b440 commit 34a7e47

69 files changed

Lines changed: 1600 additions & 11990 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,34 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/setup-node@v2
7+
- uses: actions/checkout@v6
88
with:
9-
node-version: "16"
10-
- uses: actions/checkout@v2.3.1
11-
- run: (cd website && npm ci)
12-
- run: (cd website && npm run format:test)
13-
- run: (cd website && npm run build)
14-
- uses: JamesIves/github-pages-deploy-action@4.1.4
15-
if: github.ref == 'refs/heads/master'
9+
fetch-depth: 0
10+
- uses: actions/setup-node@v6
1611
with:
17-
branch: gh-pages
18-
folder: website/build/website
12+
node-version: 25
13+
cache: yarn
14+
cache-dependency-path: yarn.lock
15+
- run: yarn install --frozen-lockfile
16+
- run: yarn format:test
17+
- run: yarn build
18+
- uses: actions/configure-pages@v5
19+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
20+
- uses: actions/upload-pages-artifact@v3
21+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
22+
with:
23+
path: .vitepress/dist
24+
deploy:
25+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
26+
needs: build
27+
permissions:
28+
pages: write
29+
id-token: write
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Deploy
36+
id: deployment
37+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
.DS_Store
2-
32
node_modules
43
.idea
5-
6-
lib/core/metadata.js
7-
lib/core/MetadataBlog.js
8-
9-
website/translated_docs
10-
website/build/
11-
website/yarn.lock
12-
website/node_modules
13-
website/i18n/*
4+
.vitepress/cache
5+
.vitepress/dist

.vitepress/config.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import {defineConfig} from 'vitepress';
2+
3+
export default defineConfig({
4+
lang: 'en-US',
5+
title: 'Gotify',
6+
description: 'a simple server for sending and receiving messages',
7+
sitemap: {hostname: 'https://gotify.net'},
8+
9+
cleanUrls: true,
10+
lastUpdated: true,
11+
srcExclude: ['README.md'],
12+
13+
head: [['link', {rel: 'icon', type: 'image/png', href: '/img/favicon.png'}]],
14+
15+
themeConfig: {
16+
logo: '/img/logo.png',
17+
externalLinkIcon: true,
18+
search: {provider: 'local'},
19+
nav: [
20+
{text: 'Docs', link: '/docs/'},
21+
{text: 'API-Docs', link: '/api-docs'},
22+
],
23+
sidebar: {
24+
'/docs/': [
25+
{
26+
text: 'Getting Started',
27+
items: [
28+
{text: 'Intro', link: '/docs/'},
29+
{text: 'Installation', link: '/docs/install'},
30+
{text: 'Configuration', link: '/docs/config'},
31+
{text: 'First Login', link: '/docs/first-login'},
32+
{text: 'Push messages', link: '/docs/pushmsg'},
33+
{text: 'Message Extras', link: '/docs/msgextras'},
34+
],
35+
},
36+
{
37+
text: 'REST-API',
38+
items: [{text: 'Swagger Documentation', link: '/api-docs'}],
39+
},
40+
{
41+
text: 'Plugins',
42+
items: [
43+
{text: 'Intro to Gotify Plugins', link: '/docs/plugin'},
44+
{text: 'Writing Plugins', link: '/docs/plugin-write'},
45+
{text: 'Building and Deploying Plugins', link: '/docs/plugin-deploy'},
46+
],
47+
},
48+
{
49+
text: 'Development',
50+
items: [
51+
{text: 'Setup Environment', link: '/docs/dev-setup'},
52+
{text: 'Servers and Tests', link: '/docs/dev-server-and-tests'},
53+
{text: 'Build Gotify', link: '/docs/build'},
54+
],
55+
},
56+
{
57+
text: 'Miscellaneous',
58+
items: [
59+
{text: 'Apache reverse proxy', link: '/docs/apache'},
60+
{text: 'Caddy 2 reverse proxy', link: '/docs/caddy'},
61+
{text: 'Haproxy reverse proxy', link: '/docs/haproxy'},
62+
{text: '(more) Push message examples', link: '/docs/more-pushmsg'},
63+
{text: 'nginx reverse proxy', link: '/docs/nginx'},
64+
{text: 'Optimize uploaded images', link: '/docs/optimize-images'},
65+
{text: 'systemd configuration', link: '/docs/systemd'},
66+
{text: 'Traefik reverse proxy', link: '/docs/traefik'},
67+
],
68+
},
69+
],
70+
},
71+
72+
editLink: {
73+
pattern: 'https://github.com/gotify/website/tree/master/:path',
74+
text: 'Edit this page on GitHub',
75+
},
76+
77+
socialLinks: [{icon: 'github', link: 'https://github.com/gotify'}],
78+
},
79+
});

.vitepress/theme/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import DefaultTheme from 'vitepress/theme';
2+
import './style.css';
3+
4+
export default DefaultTheme;

.vitepress/theme/style.css

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
:root {
2+
--vp-c-brand-1: #3498db;
3+
--vp-c-brand-soft: rgba(52, 152, 219, 0.14);
4+
}
5+
6+
.dark {
7+
--vp-c-brand-1: #5dade2;
8+
--vp-c-brand-soft: rgba(52, 152, 219, 0.16);
9+
}
10+
11+
.project-section {
12+
margin: 20px auto;
13+
padding: 24px;
14+
background-color: var(--vp-c-bg-soft);
15+
display: flex;
16+
align-items: center;
17+
gap: 40px;
18+
}
19+
20+
.project-section.reverse {
21+
flex-direction: row-reverse;
22+
}
23+
24+
.project-text {
25+
flex: 1;
26+
}
27+
28+
.project-text h2 {
29+
margin-top: 0;
30+
border-top: none;
31+
padding-top: 0;
32+
}
33+
34+
.project-text h2 a {
35+
color: var(--vp-c-brand-1);
36+
}
37+
38+
.project-image {
39+
flex: 1;
40+
}
41+
42+
.project-image img {
43+
border-radius: 8px;
44+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
45+
}
46+
47+
.store-badges p {
48+
display: flex;
49+
}
50+
.store-badges img {
51+
width: 150px;
52+
margin-right: 8px;
53+
}
54+
55+
@media (max-width: 768px) {
56+
.project-section,
57+
.project-section.reverse {
58+
flex-direction: column;
59+
}
60+
}

api-docs-fetcher.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const fetchUrls = async () => {
2+
const res = await fetch('https://api.github.com/repos/gotify/server/tags', {
3+
headers: {Accept: 'application/vnd.github.v3+json'},
4+
});
5+
if (!res.ok) {
6+
throw Error('could not fetch tags');
7+
}
8+
const tags: {name: string}[] = await res.json();
9+
return tags.map((tag) => ({
10+
url: `https://raw.githubusercontent.com/gotify/server/${tag.name}/docs/spec.json`,
11+
name: tag.name,
12+
}));
13+
};

api-docs.data.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {fetchUrls} from './api-docs-fetcher';
2+
3+
// This is evaluated at build-time: https://vitepress.dev/guide/data-loading
4+
export default {
5+
async load() {
6+
return fetchUrls();
7+
},
8+
};

api-docs.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
layout: page
3+
title: API Documentation
4+
head:
5+
- [link, {rel: stylesheet, href: /swagger/swagger-ui.css}]
6+
- [script, {src: /swagger/swagger-ui-bundle.js}]
7+
- [script, {src: /swagger/swagger-ui-standalone-preset.js}]
8+
---
9+
10+
<div id="swagger-ui"></div>
11+
12+
<script setup>
13+
import { data as urls } from './api-docs.data.ts'
14+
import { onMounted } from 'vue'
15+
import { fetchUrls } from './api-docs-fetcher.ts'
16+
17+
onMounted(() => {
18+
fetchUrls()
19+
.catch((e) => {
20+
console.log("Failed to load tags", e)
21+
return urls;
22+
})
23+
.then(urls => {
24+
window.SwaggerUIBundle({
25+
urls,
26+
dom_id: '#swagger-ui',
27+
deepLinking: true,
28+
presets: [window.SwaggerUIBundle.presets.apis, window.SwaggerUIStandalonePreset],
29+
plugins: [window.SwaggerUIBundle.plugins.DownloadUrl],
30+
layout: 'StandaloneLayout',
31+
})
32+
})
33+
})
34+
</script>

docs/apache.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
---
2-
id: apache
3-
title: Apache reverse proxy
4-
---
1+
# Apache reverse proxy
52

63
Here are configuration examples for setting up apache as reverse proxy for gotify/server.
74

docs/build.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
---
2-
id: build
3-
title: Build Gotify
4-
---
1+
# Build Gotify
52

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

0 commit comments

Comments
 (0)