Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 2 additions & 16 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,11 @@ jobs:
go-version: ^1.23
id: go

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Install XSLT tools
run: sudo apt-get update && sudo apt-get install -y python3-lxml

- name: Build
run: make build

- name: Test UI
run: make testui

- name: TestGO
run: make testgo

7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ jobs:
go-version: ^1.23
id: go

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Install XSLT tools
run: sudo apt-get update && sudo apt-get install -y python3-lxml

- name: Build
run: make all
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party/librm_lines"]
path = third_party/librm_lines
url = https://github.com/RedTTGMoss/librm_lines.git
14 changes: 0 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
ARG VERSION=0.0.0
FROM --platform=$BUILDPLATFORM node:lts AS uibuilder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable pnpm && corepack install -g pnpm@latest-9

WORKDIR /src
#COPY ui/package.json ui/pnpm-lock.yaml /src
#RUN pnpm fetch

COPY ui .
RUN pnpm install && pnpm build

FROM golang:bookworm AS gobuilder
ARG VERSION
WORKDIR /src
COPY . .
COPY --from=uibuilder /src/dist ./ui/dist
#RUN apk add git
RUN go generate ./... && CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=${VERSION}" -o rmfakecloud-docker ./cmd/rmfakecloud/

FROM scratch
Expand Down
44 changes: 10 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
VERSION :=$(shell git describe --tags --always)
VERSION := $(shell date +%Y.%m.%d.%H%M%S)
LDFLAGS := "-s -w -X main.version=$(VERSION)"
OUT_DIR := dist
CMD := ./cmd/rmfakecloud
BINARY := rmfakecloud
BUILD = go build -ldflags $(LDFLAGS) -o $(@) $(CMD)
ASSETS = ui/dist
BUILD = go build -ldflags $(LDFLAGS) -o $(@) $(CMD)
GOFILES := $(shell find . -iname '*.go' ! -iname "*_test.go")
GOFILES += $(ASSETS)
UIFILES := $(shell find ui/src)
UIFILES += $(shell find ui/public)
UIFILES += ui/package.json
STATICFILES := $(shell find internal/ui/static -type f 2>/dev/null)
THEMEFILES := $(shell find internal/ui/themes -type f 2>/dev/null)
GOFILES += $(STATICFILES)
GOFILES += $(THEMEFILES)
TARGETS := $(addprefix $(OUT_DIR)/$(BINARY)-, x64 armv6 armv7 arm64 win64 docker)
PNPM = cd ui; pnpm

.PHONY: all run runui clean test testgo testui
.PHONY: all run clean test testgo build

build: $(OUT_DIR)/$(BINARY)-x64

Expand All @@ -39,36 +37,14 @@ $(OUT_DIR)/$(BINARY)-docker:$(GOFILES)

container: $(OUT_DIR)/$(BINARY)-docker
docker build -t rmfakecloud -f Dockerfile.make .

run: $(ASSETS)
go run $(CMD) $(ARG)

$(ASSETS): $(UIFILES) ui/pnpm-lock.yaml
#@cp ui/node_modules/pdfjs-dist/build/pdf.worker.js ui/public/
$(PNPM) build
@#remove unneeded stuff, todo: eject
@rm ui/build/service-worker.js ui/build/precache-manifest* ui/build/asset-manifest.json 2> /dev/null || true

ui/pnpm-lock.yaml: ui/node_modules ui/package.json
$(PNPM) i
@touch -mr $(shell ls -Atd $? | head -1) $@

ui/node_modules:
mkdir -p $@

runui: ui/pnpm-lock.yaml
$(PNPM) run dev
run:
go run $(CMD) $(ARG)

clean:
rm -f $(OUT_DIR)/*
rm -fr $(ASSETS)

test: testui testgo

testui:
echo "TODO: fix this"
#CI=true $(PNPM) test
test: testgo

testgo:
go test ./...

2 changes: 2 additions & 0 deletions cmd/rmfakecloud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
_ "time/tzdata"

"github.com/ddvk/rmfakecloud/internal/app"
"github.com/ddvk/rmfakecloud/internal/applog"
"github.com/ddvk/rmfakecloud/internal/cli"
"github.com/ddvk/rmfakecloud/internal/config"
"github.com/gin-gonic/gin"
Expand All @@ -25,6 +26,7 @@ func configureLogging() io.Closer {
logformat := os.Getenv(config.EnvLogFormat)

logger := logrus.StandardLogger()
applog.InstallHook()
var formatter logrus.Formatter
switch logformat {
case "json":
Expand Down
5 changes: 5 additions & 0 deletions docs/install/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ The configuration is made through environment variables.
| `RM_HTTPS_COOKIE` | For the UI, force cookies to be available only via https |
| `RM_TRUST_PROXY` | Trust the proxy for client ip addresses (X-Forwarded-For/X-Real-IP) default false |
| `HASH_SCHEMA_VERSION` | Hash tree schema version: "3" or "4" (default: 3) |
| `RMFAKECLOUD_WEBAUTHN` | Enable **passkeys** (WebAuthn) for the web UI (default: `false`). Additive to password login. Requires a real HTTPS browser origin (not `http://hostname:port` or raw IPs). |
| `RMFAKECLOUD_WEBAUTHN_RPID` | Relying Party ID — hostname without scheme or port (e.g. `www.example.com`). If empty and `STORAGE_URL` is `https://…`, derived from that host. |
| `RMFAKECLOUD_WEBAUTHN_ORIGINS` | Comma-separated allowed origins (e.g. `https://www.example.com:3000`). If empty and `STORAGE_URL` is `https://…`, derived as a single origin from it. |

Manual verification steps: [passkeys checklist](passkeys-checklist.md).

## Handwriting recognition

Expand Down
11 changes: 11 additions & 0 deletions docs/install/passkeys-checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Passkeys (WebAuthn) — manual checklist

Requires `RMFAKECLOUD_WEBAUTHN=true` and HTTPS origin matching `RMFAKECLOUD_WEBAUTHN_RPID` / `ORIGINS` (or derived from https `STORAGE_URL`).

1. Open the web UI over HTTPS (not `http://acorn:3000` / raw IP).
2. Sign in with email/password.
3. Profile → **Passkeys** → Add passkey (optional label). Complete browser/OS prompt.
4. Sign out. Login page should show **Sign in with passkey**.
5. Use passkey to sign in; land on Documents; cookie/JWT works as usual.
6. Confirm password login still works.
7. Profile → remove passkey; optional: set `RMFAKECLOUD_WEBAUTHN=false` and restart → status/`Passkeys` UI hidden, login button gone.
15 changes: 13 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ go 1.23.3
toolchain go1.24.1

require (
github.com/antchfx/xmlquery v1.4.4
github.com/apognu/gocal v0.9.1
github.com/danjacques/gofslock v0.0.0-20240212154529-d899e02bfe22
github.com/dropbox/dropbox-sdk-go-unofficial/v6 v6.0.5
github.com/fogleman/gg v1.3.0
github.com/gin-gonic/gin v1.9.1
github.com/go-webauthn/webauthn v0.11.2
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/jung-kurt/gofpdf v1.16.2
github.com/juruen/rmapi v0.0.25
github.com/mochi-mqtt/server/v2 v2.7.9
github.com/poundifdef/go-remarkable2pdf v0.2.0
Expand All @@ -30,24 +34,30 @@ require (
github.com/adrg/strutil v0.3.1 // indirect
github.com/adrg/sysfont v0.1.2 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/antchfx/xpath v1.3.4 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/go-webauthn/x v0.1.14 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-tpm v0.9.1 // indirect
github.com/gorilla/i18n v0.0.0-20150820051429-8b358169da46 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jung-kurt/gofpdf v1.16.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
Expand All @@ -62,6 +72,7 @@ require (
github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a // indirect
github.com/unidoc/unichart v0.3.0 // indirect
github.com/unidoc/unitype v0.4.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/net v0.38.0 // indirect
Expand Down
Loading