Small fixes (#196)

This commit is contained in:
Thomas Miceli 2024-01-04 04:44:56 +01:00
parent 7c1d6e8bfd
commit d85917bfb2
20 changed files with 41 additions and 27 deletions

View file

@ -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..."
@ -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..."

View file

@ -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

View file

@ -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{

View file

@ -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",

View file

@ -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);

2
public/embed.scss vendored
View file

@ -11,7 +11,7 @@
@tailwind components;
@tailwind utilities;
@config "../tailwind-embed.config.js";
@config "./tailwind-embed.config.js";
.html {
-webkit-text-size-adjust: 100%;

View file

@ -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: {},

2
public/style.css vendored
View file

@ -2,7 +2,7 @@
@tailwind components;
@tailwind utilities;
@config "../tailwind.config.js";
@config "./tailwind.config.js";
@layer base {
ul, ol {

View file

@ -1,5 +1,6 @@
const colors = require('tailwindcss/colors')
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./templates/pages/gist_embed.html",

View file

@ -1,5 +1,6 @@
const colors = require('tailwindcss/colors')
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./templates/**/*.html",

12
public/tsconfig.json Normal file
View file

@ -0,0 +1,12 @@
{
"compilerOptions": {
"esModuleInterop": true
},
"files": [
"main.ts",
"editor.ts",
"admin.ts",
"gist.ts",
"embed.ts",
],
}

View file

@ -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>

View file

@ -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">
@ -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>

View file

@ -112,7 +112,7 @@
{{ template "_gist_preview" $nest }}
{{ end }}
{{ template "pagination" . }}
{{ template "_pagination" . }}
{{ else }}
<div class="text-center">
<svg xmlns="http://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">

View file

@ -16,7 +16,7 @@
{{ end }}
</div>
<div class="flex justify-center space-x-2 mt-4">
{{ template "pagination" . }}
{{ template "_pagination" . }}
</div>
{{ else }}
<div class="text-center">

View file

@ -98,7 +98,7 @@
{{end}}
</div>
<div class="flex justify-center space-x-2">
{{ template "pagination" . }}
{{ template "_pagination" . }}
</div>
{{ else }}
<div class="text-center">

View file

@ -26,7 +26,7 @@
{{ end }}
</div>
</div>
{{ template "pagination" . }}
{{ template "_pagination" . }}
{{ else }}
<div class="text-center">
<svg xmlns="http://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">

View file

@ -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">

View file

@ -1,9 +0,0 @@
{
"compilerOptions": {
"esModuleInterop": true
},
"files": [
"public/main.ts",
"public/editor.ts",
],
}