Compare commits
7 Commits
b3652f2cb0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f298e4a2a6 | |||
| b58ba41458 | |||
| f45e842370 | |||
|
|
720c32c485 | ||
| bd3842f854 | |||
| 8111812d3b | |||
| 73e05ef0ad |
@@ -8,9 +8,17 @@ on:
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
defaults:
|
||||
run:
|
||||
shell: bash -l {0}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
run: |
|
||||
if [ -d .git ]; then
|
||||
git fetch origin master && git reset --hard origin/master && git clean -fd
|
||||
else
|
||||
git clone ${{ gitea.server_url }}/${{ gitea.repository }} . && git checkout ${{ gitea.sha }}
|
||||
fi
|
||||
|
||||
- name: Install frontend dependencies
|
||||
run: cd web && npm ci
|
||||
|
||||
9
Dockerfile.oci
Normal file
9
Dockerfile.oci
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM alpine:3.21
|
||||
RUN apk add --no-cache git ca-certificates
|
||||
WORKDIR /app
|
||||
COPY repo-vis-server ./
|
||||
COPY dist ./web/dist/
|
||||
ENV PORT=8080
|
||||
ENV FRONTEND_DIR=./web/dist
|
||||
EXPOSE 8080
|
||||
CMD ["./repo-vis-server"]
|
||||
13
Makefile
13
Makefile
@@ -39,18 +39,9 @@ deploy-oci: build-arm
|
||||
ssh $(OCI_HOST) "rm -rf $(OCI_TMP) && mkdir -p $(OCI_TMP)"
|
||||
scp server/target/$(MUSL_TARGET_ARM)/release/repo-vis-server $(OCI_HOST):$(OCI_TMP)/
|
||||
cd web && tar czf /tmp/_rv_dist.tar.gz dist && scp /tmp/_rv_dist.tar.gz $(OCI_HOST):$(OCI_TMP)/
|
||||
scp Dockerfile.oci $(OCI_HOST):$(OCI_TMP)/Dockerfile
|
||||
@echo "==> Building image on OCI..."
|
||||
ssh $(OCI_HOST) 'cd $(OCI_TMP) && tar xzf _rv_dist.tar.gz && cat > Dockerfile <<DEOF\n\
|
||||
FROM alpine:3.21\n\
|
||||
RUN apk add --no-cache git ca-certificates\n\
|
||||
WORKDIR /app\n\
|
||||
COPY repo-vis-server ./\n\
|
||||
COPY dist ./web/dist/\n\
|
||||
ENV PORT=8080\n\
|
||||
ENV FRONTEND_DIR=./web/dist\n\
|
||||
EXPOSE 8080\n\
|
||||
CMD ["./repo-vis-server"]\n\
|
||||
DEOF\n\
|
||||
ssh $(OCI_HOST) 'cd $(OCI_TMP) && tar xzf _rv_dist.tar.gz && \
|
||||
sudo docker build -t repo-vis:latest . && \
|
||||
sudo docker save repo-vis:latest -o /tmp/_rv.tar && \
|
||||
sudo k3s ctr images import /tmp/_rv.tar'
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[target.aarch64-unknown-linux-musl]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
linker = "aarch64-linux-musl-gcc"
|
||||
|
||||
@@ -302,11 +302,12 @@ export class RepoRenderer {
|
||||
// Watermark — tiled path text, 45° rotated, slightly larger than code font
|
||||
if (!tile.watermark) {
|
||||
const codeFontSize = (d.h / d.lines) * 0.65;
|
||||
const wmFontSize = codeFontSize * 2.5;
|
||||
// Clamp wmFontSize to avoid degenerate tiny values on files with huge line counts
|
||||
const wmFontSize = Math.max(codeFontSize * 2.5, 1.0);
|
||||
const wmLabel = `${this.repoName}/${d.path}`;
|
||||
// Estimate how many repetitions to fill the area
|
||||
const charsPerLine = Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 0.5));
|
||||
const lineCount = Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 1.5));
|
||||
// Estimate how many repetitions to fill the area; cap to prevent RangeError on massive tiles
|
||||
const charsPerLine = Math.min(Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 0.5)), 400);
|
||||
const lineCount = Math.min(Math.ceil(Math.max(d.w, d.h) * 1.5 / (wmFontSize * 1.5)), 150);
|
||||
const wmContent = buildWatermark(wmLabel, charsPerLine, lineCount);
|
||||
|
||||
const wm = new Text();
|
||||
|
||||
Reference in New Issue
Block a user