Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.6.0 #199

Merged
merged 27 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a13ab49
Add Czech translation (#164)
pavelvachaaa Dec 15, 2023
9f19092
feat: add traditional chinese translation (#166)
exkuretrol Dec 15, 2023
22c5732
feat: default visibility (#155)
jolheiser Dec 15, 2023
fced14a
Add healthcheck endpoint (#170)
thomiceli Dec 16, 2023
24797e2
Update JS dependencies versions (#175)
thomiceli Dec 17, 2023
21e5026
Add GitLab OAuth provider (#174)
thomiceli Dec 18, 2023
32a8a4a
Trivial Typo: Change 'Gitlab' to 'GitLab' (#177)
exkuretrol Dec 18, 2023
94aac0d
Move code rendering to the backend & frontend improvements (#176)
thomiceli Dec 19, 2023
829e513
Add embedded gists & JSON gist data/metadata (#179)
thomiceli Dec 21, 2023
fcbe0a3
Add clickable Markdown checkboxes (#182)
thomiceli Dec 26, 2023
3b19265
Add custom urls for gists (#183)
thomiceli Dec 26, 2023
780cc42
Bug fixes (#184)
thomiceli Dec 27, 2023
76ff41e
Add log output config option (#172)
jahands Dec 27, 2023
ab2ea0a
Add config for default branch name (#171)
jahands Dec 27, 2023
69f4e62
Updated the hungarian translation file (#185)
WilliamNT Dec 28, 2023
c9cf0d2
Optimize reading gist files content (#186)
thomiceli Dec 30, 2023
d97203b
Optimize multiple file rendering (#189)
thomiceli Jan 1, 2024
0fe0236
Change username setting (#190)
thomiceli Jan 1, 2024
e3d396d
Add 2 new admin actions (#191)
thomiceli Jan 2, 2024
2fc8921
Fix reverse proxy subpath support (#192)
thomiceli Jan 2, 2024
799a745
Add Gist code search (#194)
thomiceli Jan 4, 2024
e487b03
Add pt-BR translation (#193)
kassane Jan 4, 2024
269ce61
chore: update taiwan translation (#195)
exkuretrol Jan 4, 2024
c636c29
Small fixes (#196)
thomiceli Jan 4, 2024
9271ce5
Update dependencies (#197)
thomiceli Jan 4, 2024
6990ac4
Add some docs (#198)
thomiceli Jan 4, 2024
e7ed4c0
v1.6.0
thomiceli Jan 4, 2024
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
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: thomiceli
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: Lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -34,10 +34,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: Check
run: make go_mod check_changes
Expand All @@ -47,7 +47,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
go: ["1.20", "1.21"]
go: ["1.21"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: Cross compile build
run: make all_crosscompile
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Changelog

## [1.6.0](https://github.com/thomiceli/opengist/compare/v1.5.3...v1.6.0) - 2024-01-04
See here how to [update](/docs/update.md) Opengist.

### Added
- Embedded gists (#179)
- Gist code search (#194)
- Custom URLS for gists (#183)
- Gist JSON data/metadata (#179)
- Keep default visibility when creating a gist on the UI (#155)
- Health check endpoint (#170)
- GitLab OAuth2 login (#174)
- Syntax highlighting for more file types (#176)
- Checkable Markdown checkboxes (#182)
- Config:
- Log output (#172)
- Default git branch name (#171)
- Change username setting (#190)
- Admin actions:
- Synchronize all gists previews (#191)
- Reset Git server hooks for all repositories (#191)
- Index all gists (#194)
- Translations:
- cs-CZ (#164)
- zh-TW (#166, #195)
- hu-HU (#185)
- pt-BR (#193)
- Docs (#198)

### Changed
- Updated dependencies (#197):
- Go `1.20` -> `1.21`
- JavaScript packages
- NodeJS Docker image `18` -> `20`
- Alpine Docker image `3.17` -> `3.19`

### Fixed
- Fix reverse proxy subpath support (#192)
- Fix undecoded gist content when going back to editing in the UI (#184)
- Fix outputting non-truncated large files for editon/zip download (#184)
- Allow dashes in usernames (#184)
- Delete SSH keys associated to deleted user (#184)
- Better error message when there is no files in gist (#184)
- Show if there is no files in gist preview (#184)
- Log parsing for the 11th empty commit (#184)
- Optimize reading gist files content (#186)

## [1.5.3](https://github.com/thomiceli/opengist/compare/v1.5.2...v1.5.3) - 2023-11-20
### Added
- es-ES translation (#139)
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.17 AS build
FROM alpine:3.19 AS build

RUN apk update && \
apk add --no-cache \
Expand All @@ -7,10 +7,10 @@ RUN apk update && \
musl-dev \
libstdc++

COPY --from=golang:1.20-alpine /usr/local/go/ /usr/local/go/
COPY --from=golang:1.21-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"

COPY --from=node:18-alpine /usr/local/ /usr/local/
COPY --from=node:20-alpine /usr/local/ /usr/local/
ENV NODE_PATH="/usr/local/lib/node_modules"
ENV PATH="/usr/local/bin:${PATH}"

Expand All @@ -21,7 +21,7 @@ COPY . .
RUN make


FROM alpine:3.17 as run
FROM alpine:3.19 as run

RUN apk update && \
apk add --no-cache \
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ install:

build_frontend:
@echo "Building frontend assets..."
npx vite build
npx vite -c public/vite.config.js build
@EMBED=1 npx postcss 'public/assets/embed-*.css' -c public/postcss.config.js --replace # until we can .nest { @tailwind } in Sass

build_backend:
@echo "Building Opengist binary..."
Expand All @@ -32,7 +33,7 @@ build_docker:

watch_frontend:
@echo "Building frontend assets..."
npx vite dev --port 16157
npx vite -c public/vite.config.js dev --port 16157

watch_backend:
@echo "Building Opengist binary..."
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ It is similiar to [GitHub Gist](https://gist.github.com/), but open-source and c

* Create public, unlisted or private snippets
* [Init](/docs/usage/init-via-git.md) / Clone / Pull / Push snippets **via Git** over HTTP or SSH
* Revisions history
* Syntax highlighting ; markdown & CSV support
* Search code in snippets ; browse users snippets, likes and forks
* Embed snippets in other websites
* Revisions history
* Like / Fork snippets
* Search for snippets ; browse users snippets, likes and forks
* Download raw files or as a ZIP archive
* OAuth2 login with GitHub, Gitea, and OpenID Connect
* OAuth2 login with GitHub, GitLab, Gitea, and OpenID Connect
* Restrict or unrestrict snippets visibility to anonymous users
* Docker support
* [More...](/docs/index.md#features)
Expand Down Expand Up @@ -77,9 +78,9 @@ Download the archive for your system from the release page [here](https://github

```shell
# example for linux amd64
wget https://github.com/thomiceli/opengist/releases/download/v1.5.2/opengist1.5.2-linux-amd64.tar.gz
wget https://github.com/thomiceli/opengist/releases/download/v1.6.0/opengist1.6.0-linux-amd64.tar.gz

tar xzvf opengist1.5.2-linux-amd64.tar.gz
tar xzvf opengist1.6.0-linux-amd64.tar.gz
cd opengist
chmod +x opengist
./opengist # with or without `--config config.yml`
Expand All @@ -89,7 +90,7 @@ Opengist is now running on port 6157, you can browse http://localhost:6157

### From source

Requirements : [Git](https://git-scm.com/downloads) (2.20+), [Go](https://go.dev/doc/install) (1.20+), [Node.js](https://nodejs.org/en/download/) (16+)
Requirements : [Git](https://git-scm.com/downloads) (2.28+), [Go](https://go.dev/doc/install) (1.21+), [Node.js](https://nodejs.org/en/download/) (16+)

```shell
git clone https://github.com/thomiceli/opengist
Expand Down
24 changes: 21 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# Set the log level to one of the following: trace, debug, info, warn, error, fatal, panic. Default: warn
log-level: warn

# Public URL for the Git HTTP/SSH connection.
# If not set, uses the URL from the request
# Set the log output to one or more of the following: `stdout`, `file`. Default: stdout,file
log-output: stdout,file

# Public URL to access to Opengist
external-url:

# Directory where Opengist will store its data. Default: ~/.opengist/
Expand All @@ -15,6 +17,16 @@ opengist-home:
# Name of the SQLite database file. Default: opengist.db
db-filename: opengist.db

# Enable or disable the code search index (either `true` or `false`). Default: true
index.enabled: true

# Name of the directory where the code search index is stored. Default: opengist.index
index.dirname: opengist.index

# Default branch name used by Opengist when initializing Git repositories.
# If not set, uses the Git default branch name. See https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup#_new_default_branch
git.default-branch:

# Set the journal mode for SQLite. Default: WAL
# See https://www.sqlite.org/pragma.html#pragma_journal_mode
sqlite.journal-mode: WAL
Expand Down Expand Up @@ -55,12 +67,18 @@ ssh.keygen-executable: ssh-keygen


# OAuth2 configuration
# The callback/redirect URL must be http://opengist.domain/oauth/<github|gitea|openid-connect>/callback
# The callback/redirect URL must be http://opengist.url/oauth/<github|gitlab|gitea|openid-connect>/callback

# To create a new OAuth2 application using GitHub : https://github.com/settings/applications/new
github.client-key:
github.secret:

# To create a new OAuth2 application using Gitlab : https://gitlab.com/-/user_settings/applications
gitlab.client-key:
gitlab.secret:
# URL of the Gitlab instance. Default: https://gitlab.com/
gitlab.url: https://gitlab.com/

# To create a new OAuth2 application using Gitea : https://gitea.domain/user/settings/applications
gitea.client-key:
gitea.secret:
Expand Down
13 changes: 13 additions & 0 deletions docs/administration/healthcheck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Healthcheck

A healthcheck is a simple HTTP GET request to the `/healthcheck` endpoint. It returns a `200 OK` response if the server is healthy.

## Example

```shell
curl http://localhost:6157/healthcheck
```

```json
{"database":"ok","opengist":"ok","time":"2024-01-04T05:18:33+01:00"}
```
30 changes: 27 additions & 3 deletions docs/administration/nginx-reverse-proxy.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Use Nginx as a reverse proxy

Configure Nginx to proxy requests to Opengist. Here is an example configuration file :
Configure Nginx to proxy requests to Opengist. Here are example configuration file to use Opengist on a subdomain or on a subpath.

Make sure you set the base url for Opengist via the [configuration](/docs/configuration/cheat-sheet.md).

### Subdomain
```
server {
listen 80;
Expand All @@ -16,7 +20,27 @@ server {
}
```

Then run :
### Subpath
```
server {
listen 80;
server_name example.com;

location /opengist/ {
rewrite ^/opengist(/.*)$ $1 break;
proxy_pass http://127.0.0.1:6157;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Prefix /opengist;
}
}
```

---

To apply changes:
```shell
service nginx restart
sudo systemctl restart nginx
```
21 changes: 17 additions & 4 deletions docs/administration/oauth-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,32 @@ Opengist can be configured to use OAuth to authenticate users, with GitHub, Gite

## Github

* Add a new OAuth app in your [Github account settings](https://github.com/settings/applications/new)
* Set 'Authorization callback URL' to `http://opengist.domain/oauth/github/callback`
* Add a new OAuth app in your [GitHub account settings](https://github.com/settings/applications/new)
* Set 'Authorization callback URL' to `http://opengist.url/oauth/github/callback`
* Copy the 'Client ID' and 'Client Secret' and add them to the [configuration](/docs/configuration/cheat-sheet.md) :
```yaml
github.client-key: <key>
github.secret: <secret>
```


## GitLab

* Add a new OAuth app in Application settings from the [GitLab instance](https://gitlab.com/-/user_settings/applications)
* Set 'Redirect URI' to `http://opengist.url/oauth/gitlab/callback`
* Copy the 'Client ID' and 'Client Secret' and add them to the [configuration](/docs/configuration/cheat-sheet.md) :
```yaml
gitlab.client-key: <key>
gitlab.secret: <secret>
# URL of the GitLab instance. Default: https://gitlab.com/
gitlab.url: https://gitlab.com/
```


## Gitea

* Add a new OAuth app in Application settings from the [Gitea instance](https://gitea.com/user/settings/applications)
* Set 'Redirect URI' to `http://opengist.domain/oauth/gitea/callback`
* Set 'Redirect URI' to `http://opengist.url/oauth/gitea/callback`
* Copy the 'Client ID' and 'Client Secret' and add them to the [configuration](/docs/configuration/cheat-sheet.md) :
```yaml
gitea.client-key: <key>
Expand All @@ -29,7 +42,7 @@ Opengist can be configured to use OAuth to authenticate users, with GitHub, Gite
## OpenID Connect

* Add a new OAuth app in Application settings of your OIDC provider
* Set 'Redirect URI' to `http://opengist.domain/oauth/openid-connect/callback`
* Set 'Redirect URI' to `http://opengist.url/oauth/openid-connect/callback`
* Copy the 'Client ID', 'Client Secret', and the discovery endpoint, and add them to the [configuration](/docs/configuration/cheat-sheet.md) :
```yaml
oidc.client-key: <key>
Expand Down
Loading