Skip to content

Commit

Permalink
Small fixes (thomiceli#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomiceli committed Jan 4, 2024
1 parent 7c1d6e8 commit d85917b
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 27 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ install:

build_frontend:
@echo "Building frontend assets..."
npx vite build
@EMBED=1 npx postcss 'public/assets/embed-*.css' -c postcss.config.js --replace # until we can .nest { @tailwind } in Sass
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 @@ -33,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
2 changes: 1 addition & 1 deletion internal/ssh/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func listen(serverConfig *ssh.ServerConfig) {
go func() {
sConn, channels, reqs, err := ssh.NewServerConn(nConn, serverConfig)
if err != nil {
if !(err != io.EOF && !errors.Is(err, syscall.ECONNRESET)) {
if err != io.EOF && !errors.Is(err, syscall.ECONNRESET) {
errorSsh("Failed to handshake", err)
}
return
Expand Down
2 changes: 1 addition & 1 deletion internal/web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func NewServer(isDev bool) *Server {
return nil
},
}))
// e.Use(middleware.Recover())
e.Use(middleware.Recover())
e.Use(middleware.Secure())

e.Renderer = &Template{
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "opengist",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "node_modules/.bin/vite",
"build": "node_modules/.bin/vite build",
"preview": "node_modules/.bin/vite preview"
"dev": "node_modules/.bin/vite -c public/vite.config.js",
"build": "node_modules/.bin/vite -c public/vite.config.js build",
"preview": "node_modules/.bin/vite -c public/vite.config.js preview"
},
"devDependencies": {
"@codemirror/commands": "^6.2.2",
Expand Down
1 change: 1 addition & 0 deletions public/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ document.addEventListener('DOMContentLoaded', () => {
});

const setSetting = (key: string, value: string) => {
// @ts-ignore
const baseUrl = window.opengist_base_url || '';
const data = new URLSearchParams();
data.append('key', key);
Expand Down
2 changes: 1 addition & 1 deletion public/embed.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@tailwind components;
@tailwind utilities;

@config "../tailwind-embed.config.js";
@config "./tailwind-embed.config.js";

.html {
-webkit-text-size-adjust: 100%;
Expand Down
4 changes: 3 additions & 1 deletion postcss.config.js → public/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ module.exports = {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
tailwindcss: {
config: "./public/tailwind.config.js",
},
autoprefixer: {},
'postcss-selector-namespace': {namespace() {return (process.env.EMBED) ? '.opengist-embed' : '';}},
cssnano: {},
Expand Down
2 changes: 1 addition & 1 deletion public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@tailwind components;
@tailwind utilities;

@config "../tailwind.config.js";
@config "./tailwind.config.js";

@layer base {
ul, ol {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const colors = require('tailwindcss/colors')

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./templates/pages/gist_embed.html",
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js → public/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const colors = require('tailwindcss/colors')

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./templates/**/*.html",
Expand Down
12 changes: 12 additions & 0 deletions public/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"esModuleInterop": true
},
"files": [
"main.ts",
"editor.ts",
"admin.ts",
"gist.ts",
"embed.ts",
],
}
File renamed without changes.
2 changes: 1 addition & 1 deletion templates/base/admin_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ define "admin_footer" }}
{{ if .urlPage }}
<div class="flex mt-4 justify-center space-x-2">
{{ template "pagination" . }}
{{ template "_pagination" . }}
</div>
{{ end }}
</main>
Expand Down
7 changes: 7 additions & 0 deletions templates/pages/admin_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
</div>
</div>
<dt>Log level</dt><dd>{{ .c.LogLevel }}</dd>
<dt>Log output</dt><dd>{{ .c.LogOutput }}</dd>
<dt>External URL</dt><dd>{{ .c.ExternalUrl }}</dd>
<dt>Opengist home</dt><dd>{{ .c.OpengistHome }}</dd>
<dt>DB filename</dt><dd>{{ .c.DBFilename }}</dd>
<dt>Index Enabled</dt><dd>{{ .c.IndexEnabled }}</dd>
<dt>Index Dirname</dt><dd>{{ .c.IndexDirname }}</dd>
<dt>Git default branch</dt><dd>{{ .c.GitDefaultBranch }}</dd>
<dt>SQLite Journal Mode</dt><dd>{{ .c.SqliteJournalMode }}</dd>
<div class="relative col-span-3 mt-4">
<div class="absolute inset-0 flex items-center" aria-hidden="true">
Expand Down Expand Up @@ -52,6 +56,9 @@
</div>
<dt>Github Client key</dt><dd>{{ .c.GithubClientKey }}</dd>
<dt>Github Secret</dt><dd>{{ .c.GithubSecret }}</dd>
<dt>GitLab client Key</dt><dd>{{ .c.GitlabClientKey }}</dd>
<dt>GitLab Secret</dt><dd>{{ .c.GitlabSecret }}</dd>
<dt>GitLab URL</dt><dd>{{ .c.GitlabUrl }}</dd>
<dt>Gitea client Key</dt><dd>{{ .c.GiteaClientKey }}</dd>
<dt>Gitea Secret</dt><dd>{{ .c.GiteaSecret }}</dd>
<dt>Gitea URL</dt><dd>{{ .c.GiteaUrl }}</dd>
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h1 class="text-2xl font-bold leading-tight">{{ .locale.Tr "gist.list.search-res
{{ template "_gist_preview" $nest }}
{{ end }}

{{ template "pagination" . }}
{{ template "_pagination" . }}
{{ else }}
<div class="text-center">
<svg xmlns="http:https://www.w3.org/2000/svg" class="mx-auto h-12 w-12 text-slate-600 dark:text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/likes.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h3 class="text-xl font-bold leading-tight break-all py-2">{{ .locale.Tr "gist.l
{{ end }}
</div>
<div class="flex justify-center space-x-2 mt-4">
{{ template "pagination" . }}
{{ template "_pagination" . }}
</div>
{{ else }}
<div class="text-center">
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/revisions.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h3 class="text-sm py-2 flex-auto">
{{end}}
</div>
<div class="flex justify-center space-x-2">
{{ template "pagination" . }}
{{ template "_pagination" . }}
</div>
{{ else }}
<div class="text-center">
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1 class="text-2xl font-bold leading-tight">{{ .nbHits }} {{ .locale.Tr "gist.s
{{ end }}
</div>
</div>
{{ template "pagination" . }}
{{ template "_pagination" . }}
{{ else }}
<div class="text-center">
<svg xmlns="http:https://www.w3.org/2000/svg" class="mx-auto h-12 w-12 text-slate-600 dark:text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ define "pagination" }}
{{ define "_pagination" }}
<div class="flex justify-center space-x-2">
{{ if .prevPage }}
<a href="{{ $.c.ExternalUrl }}/{{ .urlPage }}?page={{ .prevPage }}{{ .urlParams }}" class="relative inline-flex items-center space-x-2 rounded-md border border-white dark:border-gray-900 bg-white dark:bg-gray-900 px-2 py-1.5 font-medium text-slate-700 dark:text-slate-300 hover:border-gray-200 dark:hover:border-gray-400 hover:text-slate-700 dark:hover:text-slate-300 focus:border-primary-500 focus:outline-none focus:ring-1 focus:ring-primary-500 text-sm leading-4">
Expand Down
9 changes: 0 additions & 9 deletions tsconfig.json

This file was deleted.

0 comments on commit d85917b

Please sign in to comment.