Compare commits
7 Commits
bb33278399
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8903352565 | |||
| 9a77996057 | |||
| 8fd73ec786 | |||
| a324d24b72 | |||
| 98c69dfc7d | |||
| 7abbc2c9ae | |||
| 0e7087bd08 |
51
.gitea/workflows/registry.yml
Normal file
51
.gitea/workflows/registry.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
name: release-tag
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
jobs:
|
||||||
|
release-image:
|
||||||
|
runs-on: ubuntu-fast
|
||||||
|
env:
|
||||||
|
DOCKER_ORG: ${{ vars.DOCKER_ORG }}
|
||||||
|
DOCKER_LATEST: latest
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker BuildX
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with: # replace it with your local IP
|
||||||
|
config-inline: |
|
||||||
|
[registry."${{ vars.DOCKER_REGISTRY }}"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.DOCKER_REGISTRY }} # replace it with your local IP
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Get Meta
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
||||||
|
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: | # replace it with your local IP and tags
|
||||||
|
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
||||||
|
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
|
||||||
124
.gitea/workflows/release.yml
Normal file
124
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
# Git(tea) Actions workflow: Build and publish standalone binaries **plus** bundled `static/` assets
|
||||||
|
# ────────────────────────────────────────────────────────────────────
|
||||||
|
# ✧ Builds the Go‑based WoL server for four targets **and** packt das Verzeichnis
|
||||||
|
# `static` zusammen mit der Binary, sodass es relativ zur ausführbaren Datei
|
||||||
|
# liegt (wichtig für die eingebauten Bootstrap‑Assets & favicon).
|
||||||
|
#
|
||||||
|
# • linux/amd64 → wol-server-linux-amd64.tar.gz
|
||||||
|
# • linux/arm64 → wol-server-linux-arm64.tar.gz
|
||||||
|
# • linux/arm/v7 → wol-server-linux-armv7.tar.gz
|
||||||
|
# • windows/amd64 → wol-server-windows-amd64.zip
|
||||||
|
#
|
||||||
|
# ✧ Artefakte landen im Workflow und – bei Tag‑Push (vX.Y.Z) – als Release‑Assets.
|
||||||
|
#
|
||||||
|
# Secrets/variables:
|
||||||
|
# GITEA_TOKEN – optional, falls default token keine Release‑Rechte hat.
|
||||||
|
# ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
name: build-binaries
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
tags: [ "v*" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-fast
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
ext: ""
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
ext: ""
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm
|
||||||
|
goarm: "7"
|
||||||
|
ext: ""
|
||||||
|
- goos: windows
|
||||||
|
goarch: amd64
|
||||||
|
ext: ".exe"
|
||||||
|
|
||||||
|
env:
|
||||||
|
GO_VERSION: "1.24"
|
||||||
|
BINARY_NAME: virtual-clipboard
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Go ${{ env.GO_VERSION }}
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}${{ matrix.goarm && format('/v{0}', matrix.goarm) || '' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
mkdir -p dist/package
|
||||||
|
if [ -n "${{ matrix.goarm }}" ]; then export GOARM=${{ matrix.goarm }}; fi
|
||||||
|
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -ldflags "-s -w" \
|
||||||
|
-o "dist/package/${BINARY_NAME}${{ matrix.ext }}" .
|
||||||
|
# Assets: statisches Verzeichnis beilegen
|
||||||
|
cp -r web dist/package/
|
||||||
|
|
||||||
|
- name: Package archive with static assets
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
cd dist
|
||||||
|
if [ "${{ matrix.goos }}" == "windows" ]; then
|
||||||
|
ZIP_NAME="${BINARY_NAME}-windows-amd64.zip"
|
||||||
|
(cd package && zip -r "../$ZIP_NAME" .)
|
||||||
|
else
|
||||||
|
ARCH_SUFFIX="${{ matrix.goarch }}"
|
||||||
|
if [ "${{ matrix.goarch }}" == "arm" ]; then ARCH_SUFFIX="armv${{ matrix.goarm }}"; fi
|
||||||
|
TAR_NAME="${BINARY_NAME}-${{ matrix.goos }}-${ARCH_SUFFIX}.tar.gz"
|
||||||
|
tar -czf "$TAR_NAME" -C package .
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload workflow artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}
|
||||||
|
path: dist/*.tar.gz
|
||||||
|
if-no-files-found: ignore
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: windows-amd64
|
||||||
|
path: dist/*.zip
|
||||||
|
if-no-files-found: ignore
|
||||||
|
|
||||||
|
# Release Schritt für Tag‑Pushes
|
||||||
|
release:
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-fast
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
path: ./dist
|
||||||
|
|
||||||
|
- name: Create / Update release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
|
||||||
|
with:
|
||||||
|
name: "Release ${{ github.ref_name }}"
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
files: |
|
||||||
|
dist/**/virtual-clipboard-*.tar.gz
|
||||||
|
dist/**/virtual-clipboard-*.zip
|
||||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# -------- Dockerfile (Multi-Stage Build) --------
|
||||||
|
# 1. Builder-Stage
|
||||||
|
FROM golang:1.25-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY go.* ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/vcc
|
||||||
|
|
||||||
|
# 2. Runtime-Stage
|
||||||
|
FROM alpine:3.22
|
||||||
|
|
||||||
|
# HTTPS-Callouts in Alpine brauchen ca-certificates
|
||||||
|
RUN apk add --no-cache ca-certificates
|
||||||
|
RUN mkdir /web
|
||||||
|
COPY --from=builder /bin/vcc /bin/vcc
|
||||||
|
COPY ./web /bin/web
|
||||||
|
# Default listens on :8090 – siehe main.go
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Environment defaults; können per compose überschrieben werden
|
||||||
|
ENV CLIPBOARD_TOKEN="" \
|
||||||
|
CLIPBOARD_DATA="" \
|
||||||
|
PORT=":8080" \
|
||||||
|
MAX_PER_ROOM=200
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/vcc"]
|
||||||
@@ -3,13 +3,13 @@
|
|||||||
"rooms": {
|
"rooms": {
|
||||||
"default": [
|
"default": [
|
||||||
{
|
{
|
||||||
"id": "20250905T103347.497751500Z-f12bf341402200b2",
|
"id": "20250906T230610.920156600Z-9cb85e5bffcf0eef",
|
||||||
"room": "default",
|
"room": "default",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"content": "demo",
|
"content": "2ao+A?7=Tbp,t*7$3Yo9",
|
||||||
"author": "Jan",
|
"created_at": "2025-09-06T23:06:10.9201566Z"
|
||||||
"created_at": "2025-09-05T10:33:47.4977515Z"
|
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"privat": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,3 +1,3 @@
|
|||||||
module git.send.nrw/sendnrw/virtual-clipboard
|
module git.send.nrw/sendnrw/virtual-clipboard
|
||||||
|
|
||||||
go 1.24.4
|
go 1.25.3
|
||||||
|
|||||||
4
main.go
4
main.go
@@ -487,7 +487,7 @@ func (s *Server) routes() http.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
port := getenv("PORT", "8080")
|
port := getenv("PORT", ":8080")
|
||||||
maxPerRoom := getenvInt("MAX_PER_ROOM", 200)
|
maxPerRoom := getenvInt("MAX_PER_ROOM", 200)
|
||||||
secret := os.Getenv("CLIPBOARD_TOKEN")
|
secret := os.Getenv("CLIPBOARD_TOKEN")
|
||||||
persist := os.Getenv("CLIPBOARD_DATA")
|
persist := os.Getenv("CLIPBOARD_DATA")
|
||||||
@@ -498,7 +498,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: ":" + port,
|
Addr: port,
|
||||||
Handler: s.routes(),
|
Handler: s.routes(),
|
||||||
ReadHeaderTimeout: 10 * time.Second,
|
ReadHeaderTimeout: 10 * time.Second,
|
||||||
}
|
}
|
||||||
|
|||||||
142
web/index.html
142
web/index.html
@@ -5,26 +5,128 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Virtuelle Zwischenablage</title>
|
<title>Virtuelle Zwischenablage</title>
|
||||||
<style>
|
<style>
|
||||||
:root { font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif; }
|
:root {
|
||||||
body { margin: 0; background: #0b0f19; color: #e6e6e6; }
|
font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
|
||||||
header { padding: 16px 20px; border-bottom: 1px solid #1f2637; position: sticky; top: 0; background: #0b0f19; z-index: 1; }
|
}
|
||||||
h1 { margin: 0; font-size: 18px; }
|
|
||||||
main { max-width: 900px; margin: 0 auto; padding: 20px; }
|
body {
|
||||||
.row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
|
margin: 0;
|
||||||
.grid { display: grid; gap: 12px; }
|
background: #f9fafb; /* sehr helles Grau statt fast Schwarz */
|
||||||
input, textarea, select, button { background: #131a2a; border: 1px solid #22304d; color: #e6e6e6; border-radius: 10px; padding: 10px; font-size: 14px; }
|
color: #222; /* dunkle Schrift */
|
||||||
button { cursor: pointer; }
|
}
|
||||||
button.primary { background: #3b82f6; border-color: #3b82f6; color: #fff; }
|
|
||||||
.card { border: 1px solid #1f2637; background: #0f1524; border-radius: 14px; padding: 14px; }
|
header {
|
||||||
.list { display: grid; gap: 10px; }
|
padding: 16px 20px;
|
||||||
.clip { display: grid; gap: 6px; border: 1px solid #22304d; padding: 10px; border-radius: 12px; background: #0b1222; }
|
border-bottom: 1px solid #e5e7eb; /* helles Grau */
|
||||||
.meta { color: #9aa6c6; font-size: 12px; display: flex; gap: 10px; align-items: center; }
|
position: sticky;
|
||||||
.actions { display: flex; gap: 8px; }
|
top: 0;
|
||||||
.muted { color: #9aa6c6; }
|
background: #ffffff; /* weißer Header */
|
||||||
.inline { display: inline-flex; gap: 8px; align-items: center; }
|
z-index: 1;
|
||||||
.pill { background: #14203a; border: 1px solid #22304d; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
|
}
|
||||||
a { color: #7cb2ff; text-decoration: none; }
|
|
||||||
</style>
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
max-width: 900px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, textarea, select, button {
|
||||||
|
background: #ffffff; /* weißer Hintergrund */
|
||||||
|
border: 1px solid #d1d5db; /* hellgraue Umrandung */
|
||||||
|
color: #111; /* dunkler Text */
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.primary {
|
||||||
|
background: #3b82f6; /* freundliches Blau */
|
||||||
|
border-color: #3b82f6;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
background: #ffffff; /* weiße Karten */
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 14px;
|
||||||
|
box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* leichter Schatten */
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clip {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #f3f4f6; /* hellgrauer Hintergrund */
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta {
|
||||||
|
color: #6b7280; /* mittleres Grau */
|
||||||
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted {
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill {
|
||||||
|
background: #e5e7eb; /* graue Badge */
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #2563eb; /* satteres Blau */
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
|||||||
Reference in New Issue
Block a user