Skip to content

Commit 6d31ef9

Browse files
thomicelijiriks74
andauthored
Add Vitepress docs (#326)
* Add vitepress for docs * some fix * Use vitepress and update docs * Use vitepress and update docs * Update README.md * Add favicon * Add docs by @jiriks74 Co-authored-by: jiriks74 <[email protected]> --------- Co-authored-by: jiriks74 <[email protected]>
1 parent 678fb99 commit 6d31ef9

29 files changed

+1300
-1498
lines changed

.github/workflows/docs.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build / Deploy docs
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Install JS dependencies
22+
run: |
23+
24+
25+
- name: Build docs
26+
run: |
27+
cd docs
28+
npx tailwindcss -i .vitepress/theme/style.css -o .vitepress/theme/theme.css -c .vitepress/tailwind.config.js
29+
npm run docs:build
30+
31+
- name: Deploy to server
32+
uses: appleboy/scp-action@master
33+
with:
34+
host: ${{ secrets.SERVER_HOST }}
35+
username: ${{ secrets.SERVER_USERNAME }}
36+
key: ${{ secrets.SERVER_SSH_KEY }}
37+
source: "docs/.vitepress/dist/*"
38+
target: ${{ secrets.SERVER_PATH }}
39+
40+
- name: Update remote docs
41+
uses: appleboy/ssh-action@master
42+
with:
43+
host: ${{ secrets.SERVER_HOST }}
44+
username: ${{ secrets.SERVER_USERNAME }}
45+
key: ${{ secrets.SERVER_SSH_KEY }}
46+
script: |
47+
${{ secrets.UPDATE_DOCS }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ public/assets/*
77
public/manifest.json
88
opengist
99
build/
10+
docs/.vitepress/dist/
11+
docs/.vitepress/cache/

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Opengist
22

3-
<img height="108px" src="https://raw.githubusercontent.com/thomiceli/opengist/a9dd531f676d01b93bb6bd70751a69382ca563b0/public/opengist.svg" alt="Opengist" align="right" />
3+
<img height="108px" src="https://raw.githubusercontent.com/thomiceli/opengist/master/public/opengist.svg" alt="Opengist" align="right" />
44

55
Opengist is a **self-hosted** pastebin **powered by Git**. All snippets are stored in a Git repository and can be
66
read and/or modified using standard Git commands, or with the web interface.
77
It is similiar to [GitHub Gist](https://gist.github.com/), but open-source and could be self-hosted.
88

9-
[Documentation](/docs)[Discord](https://discord.gg/9Pm3X5scZT)[Demo](https://demo.opengist.io)
9+
[Home Page](https://opengist.io)[Documentation](https://opengist.io/docs)[Discord](https://discord.gg/9Pm3X5scZT)[Demo](https://demo.opengist.io)
1010

1111

1212
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/thomiceli/opengist?sort=semver)
@@ -103,11 +103,11 @@ Opengist is now running on port 6157, you can browse http://localhost:6157
103103

104104
---
105105

106-
To create and run a development environment, see [run-development.md](/docs/contributing/run-development.md).
106+
To create and run a development environment, see [run-development.md](/docs/contributing/development.md).
107107

108108
## Documentation
109109

110-
The documentation is available in [/docs](/docs) directory.
110+
The documentation is available at [https://opengist.io/](https://opengist.io/) or in the [/docs](/docs) directory.
111111

112112

113113
## License

docs/.vitepress/config.mts

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import {defineConfig} from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "Opengist",
6+
description: "Documention for Opengist",
7+
rewrites: {
8+
'index.md': 'index.md',
9+
'introduction.md': 'docs/index.md',
10+
':path(.*)': 'docs/:path'
11+
},
12+
themeConfig: {
13+
// https://vitepress.dev/reference/default-theme-config
14+
logo: 'https://raw.githubusercontent.com/thomiceli/opengist/master/public/opengist.svg',
15+
logoLink: '/',
16+
nav: [
17+
{ text: 'Demo', link: 'https://demo.opengist.io' },
18+
{ text: 'Translate', link: 'https://tr.opengist.io' }
19+
],
20+
21+
sidebar: {
22+
'/docs/': [
23+
{
24+
text: '', items: [
25+
{text: 'Introduction', link: '/docs'},
26+
{text: 'Installation', link: '/docs/installation', items: [
27+
{text: 'Docker', link: '/docs/installation/docker'},
28+
{text: 'Binary', link: '/docs/installation/binary'},
29+
{text: 'Source', link: '/docs/installation/source'},
30+
],
31+
collapsed: true
32+
},
33+
{text: 'Update', link: '/docs/update'},
34+
], collapsed: false
35+
},
36+
{
37+
text: 'Configuration', base: '/docs/configuration', items: [
38+
{text: 'Configure Opengist', link: '/configure'},
39+
{text: 'Admin panel', link: '/admin-panel'},
40+
{text: 'OAuth Providers', link: '/oauth-providers'},
41+
{text: 'Custom assets', link: '/custom-assets'},
42+
{text: 'Custom links', link: '/custom-links'},
43+
{text: 'Cheat Sheet', link: '/cheat-sheet'},
44+
], collapsed: false
45+
},
46+
{
47+
text: 'Usage', base: '/docs/usage', items: [
48+
{text: 'Init via Git', link: '/init-via-git'},
49+
{text: 'Embed Gist', link: '/embed'},
50+
{text: 'Gist as JSON', link: '/gist-json'},
51+
{text: 'Import Gists from Github', link: '/import-from-github-gist'},
52+
{text: 'Git push options', link: '/git-push-options'},
53+
], collapsed: false
54+
},
55+
{
56+
text: 'Administration', base: '/docs/administration', items: [
57+
{text: 'Run with systemd', link: '/run-with-systemd'},
58+
{text: 'Reverse proxy', items: [
59+
{text: 'Nginx', link: '/nginx-reverse-proxy'},
60+
{text: 'Traefik', link: '/traefik-reverse-proxy'},
61+
], collapsed: true},
62+
{text: 'Fail2ban', link: '/fail2ban-setup'},
63+
{text: 'Healthcheck', link: '/healthcheck'},
64+
], collapsed: false
65+
},
66+
{
67+
text: 'Contributing', base: '/docs/contributing', items: [
68+
{text: 'Community', link: '/community'},
69+
{text: 'Development', link: '/development'},
70+
], collapsed: false
71+
},
72+
73+
]},
74+
75+
socialLinks: [
76+
{icon: 'github', link: 'https://github.com/thomiceli/opengist'}
77+
],
78+
editLink: {
79+
pattern: 'https://github.com/thomiceli/opengist/edit/stable/docs/:path'
80+
},
81+
// @ts-ignore
82+
lastUpdated: true,
83+
84+
},
85+
head: [
86+
['link', {rel: 'icon', href: '/favicon.svg'}],
87+
],
88+
ignoreDeadLinks: true
89+
})

docs/.vitepress/tailwind.config.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const colors = require('tailwindcss/colors')
2+
3+
/** @type {import('tailwindcss').Config} */
4+
module.exports = {
5+
content: [
6+
"./.vitepress/theme/*.vue",
7+
],
8+
theme: {
9+
colors: {
10+
transparent: 'transparent',
11+
current: 'currentColor',
12+
white: colors.white,
13+
black: colors.black,
14+
gray: {
15+
50: "#EEEFF1",
16+
100: "#DEDFE3",
17+
200: "#BABCC5",
18+
300: "#999CA8",
19+
400: "#75798A",
20+
500: "#585B68",
21+
600: "#464853",
22+
700: "#363840",
23+
800: "#232429",
24+
900: "#131316"
25+
},
26+
indigo: colors.indigo,
27+
28+
},
29+
extend: {
30+
borderWidth: {
31+
'1': '1px',
32+
}
33+
},
34+
},
35+
plugins: [],
36+
darkMode: 'class',
37+
}

docs/.vitepress/theme/Home.vue

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<script>
2+
import { withBase } from 'vitepress';
3+
import './theme.css'
4+
5+
export default {
6+
7+
setup() {
8+
return { withBase };
9+
},
10+
};
11+
12+
</script>
13+
14+
15+
<template>
16+
<main class="home">
17+
<header class="hero">
18+
<div class="mx-auto max-w-7xl px-6 lg:px-8">
19+
<div class="mx-auto lg:text-center">
20+
<img class="rotating h-36 mx-auto my-8 " src="https://raw.githubusercontent.com/thomiceli/opengist/master/public/opengist.svg" alt="" >
21+
<a target="_blank" href="https://github.com/thomiceli/opengist/releases" class="inline-flex items-center rounded-full bg-indigo-100 hover:bg-indigo-200 px-4 py-1.5 text-lg font-medium text-indigo-700">
22+
<span class="pr-1">Released 1.7.4</span>
23+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
24+
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25" />
25+
</svg>
26+
</a>
27+
<h1 class="mt-5 text-4xl font-bold tracking-tight sm:text-5xl">Opengist</h1>
28+
<h2 class="mt-4 text-xl">Self-hosted pastebin powered by Git, open-source alternative to Github Gist.</h2>
29+
</div>
30+
<div class="space-x-2 my-12">
31+
<a href="/docs" class="rounded-md bg-indigo-600 mt-6 px-5 py-3 text-xl font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Docs</a>
32+
<a target="_blank" href="https://demo.opengist.io" class="rounded-md bg-indigo-400 mt-6 px-5 py-3 text-xl border-white font-semibold text-white shadow-sm hover:bg-indigo-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Live demo</a>
33+
<a target="_blank" href="https://github.com/thomiceli/opengist" class="rounded-md bg-gray-800 mt-6 px-3 py-3 text-xl dark:border dark:border-1 dark:border-gray-400 font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
34+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" class="w-7 h-auto inline" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"></path></svg>
35+
</a>
36+
</div>
37+
<div class="border border-1 mt-6 px-5 py-3 rounded-md shadow-sm ">
38+
<code class="select-all ">docker run --name <span class="text-indigo-700 dark:text-indigo-300 font-bold">opengist</span> -p <span class="text-indigo-700 dark:text-indigo-300 font-bold">6157</span>:6157 -v "<span class="text-indigo-700 dark:text-indigo-300 font-bold">$HOME/.opengist</span>:/opengist" ghcr.io/thomiceli/opengist:1</code>
39+
</div>
40+
</div>
41+
</header>
42+
43+
<div class="relative w-full sm:max-w-7xl mx-auto overflow-auto">
44+
<img class="block w-[200vw] max-w-none sm:w-full h-auto" :src="withBase('/opengist-demo.png')" alt="demo-opengist-screenshot" />
45+
</div>
46+
47+
</main>
48+
</template>
49+
50+
51+
52+
<style>
53+
@-webkit-keyframes rotating /* Safari and Chrome */ {
54+
from {
55+
-webkit-transform: rotate(0deg);
56+
-o-transform: rotate(0deg);
57+
transform: rotate(0deg);
58+
}
59+
to {
60+
-webkit-transform: rotate(360deg);
61+
-o-transform: rotate(360deg);
62+
transform: rotate(360deg);
63+
}
64+
}
65+
@keyframes rotating {
66+
from {
67+
-ms-transform: rotate(0deg);
68+
-moz-transform: rotate(0deg);
69+
-webkit-transform: rotate(0deg);
70+
-o-transform: rotate(0deg);
71+
transform: rotate(0deg);
72+
}
73+
to {
74+
-ms-transform: rotate(360deg);
75+
-moz-transform: rotate(360deg);
76+
-webkit-transform: rotate(360deg);
77+
-o-transform: rotate(360deg);
78+
transform: rotate(360deg);
79+
}
80+
}
81+
82+
.home {
83+
84+
-webkit-font-smoothing: antialiased;
85+
-moz-osx-font-smoothing: grayscale;
86+
display: flex;
87+
flex-direction: column;
88+
gap: 1rem;
89+
text-align: center;
90+
}
91+
92+
.rotating {
93+
-webkit-animation: rotating 8s linear infinite;
94+
-moz-animation: rotating 4s linear infinite;
95+
-ms-animation: rotating 4s linear infinite;
96+
-o-animation: rotating 4s linear infinite;
97+
animation: rotating 12s linear infinite;
98+
}
99+
100+
101+
</style>

docs/.vitepress/theme/Layout.vue

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script setup>
2+
import { useData } from 'vitepress'
3+
import Home from './Home.vue'
4+
import DefaultTheme from 'vitepress/theme'
5+
6+
const { Layout } = DefaultTheme
7+
const { frontmatter } = useData()
8+
</script>
9+
10+
<template>
11+
<Layout>
12+
<template v-if="frontmatter.layout === 'home'" #home-hero-after>
13+
<Home />
14+
</template>
15+
</Layout>
16+
</template>

docs/.vitepress/theme/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { h } from 'vue'
2+
import type { Theme } from 'vitepress'
3+
import DefaultTheme from 'vitepress/theme'
4+
import Layout from "./Layout.vue";
5+
6+
export default {
7+
...DefaultTheme,
8+
Layout,
9+
enhanceApp({ app, router, siteData }) {
10+
// ...
11+
}
12+
} satisfies Theme

0 commit comments

Comments
 (0)