Skip to content
Merged
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

## [Não publicado]
- **Tema Clube Naval** em `themes/clube-naval` (azul-marinho, dourado e vinho; escudo na interface e logo completa em e-mail e PDF).
## [0.0.11] - Temas: Clube Naval e ícone da aba
- **Ícone da aba acompanha a logo** do tema ativo (ou a logo enviada em Aparência); sem logo própria, continua a coruja.
- **Tema Clube Naval** em `themes/clube-naval` (botões no vermelho da âncora do brasão e dourado; escudo na interface e logo completa em e-mail e PDF).

## [0.0.10] - Fase 9 · Login com um clique e Dropbox
- **Dropbox:** novo destino, com login por popup (cliente público, sem segredo) e acesso só à pasta do aplicativo. Envio em partes com retomada, conferência pelo `content_hash` do Dropbox, retenção, download e restauração. Como o Dropbox não tem endereço pré-autorizado para arquivos grandes, o agente recebe um **token de curta duração só de escrita de conteúdo** (exceção à regra "o agente não recebe tokens"); cada envio precisa terminar antes de o token vencer (cerca de 4 horas).
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN mkdir -p /src/internal/webui && npm run build
# Os estágios web e gobuild rodam na plataforma nativa do runner (sem emulação); só o binário é cruzado.
# --- binários Go -----------------------------------------------------------------------------------------------------
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS gobuild
ARG VERSION=0.0.10
ARG VERSION=0.0.11
ARG TARGETOS
ARG TARGETARCH
WORKDIR /src
Expand All @@ -32,7 +32,7 @@ RUN --mount=type=secret,id=google_client_secret --mount=type=secret,id=google_we

# --- Server ------------------------------------------------------------------------------------------------------------
FROM alpine:3.21 AS server
ARG VERSION=0.0.10
ARG VERSION=0.0.11
LABEL org.opencontainers.image.title="Coruja Backup Server" \
org.opencontainers.image.description="Backup centralizado: orquestração, agendamentos, nuvem e interface web" \
org.opencontainers.image.source="https://github.com/AprendendoLinux/corujabackup" \
Expand All @@ -48,7 +48,7 @@ ENTRYPOINT ["/usr/local/bin/coruja-server"]

# --- Agente ------------------------------------------------------------------------------------------------------------
FROM alpine:3.21 AS agent
ARG VERSION=0.0.10
ARG VERSION=0.0.11
LABEL org.opencontainers.image.title="Coruja Backup Agent" \
org.opencontainers.image.description="Agente leve do Coruja Backup (conecta ao Server por IP:porta)" \
org.opencontainers.image.source="https://github.com/AprendendoLinux/corujabackup" \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Sistema de backup **centralizado**, em Docker, gerenciado por **interface web**. Um **Server** orquestra tudo; **Agentes** leves rodam
nos servidores de destino e se conectam a ele informando só **IP:porta + token**.

> **Versão 0.0.10** · [Changelog](CHANGELOG.md) · [Instalação](docs/INSTALACAO.md) · [Operação](docs/OPERACAO.md) · [Segurança](docs/SEGURANCA.md) · [FAQ](docs/FAQ.md)
> **Versão 0.0.11** · [Changelog](CHANGELOG.md) · [Instalação](docs/INSTALACAO.md) · [Operação](docs/OPERACAO.md) · [Segurança](docs/SEGURANCA.md) · [FAQ](docs/FAQ.md)

## O que faz

Expand Down Expand Up @@ -67,4 +67,4 @@ docker run --rm --network SUA_REDE -e CORUJA_TEST_DSN='usuario:senha@tcp(db:3306
```

---
Coruja Backup - Versão 0.0.10 - Desenvolvido por [Henrique Fagundes](https://henrique.tec.br) · Licença MIT
Coruja Backup - Versão 0.0.11 - Desenvolvido por [Henrique Fagundes](https://henrique.tec.br) · Licença MIT
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.10
0.0.11
2 changes: 1 addition & 1 deletion deploy/docker-compose.agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Informe o endereço do canal dos agentes do Server e o token gerado na interface (Agentes > Novo agente; vale uma vez).
services:
agent:
image: ghcr.io/aprendendolinux/corujabackup-agent:0.0.10
image: ghcr.io/aprendendolinux/corujabackup-agent:0.0.11
container_name: corujabackup-agent
restart: always
environment:
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker-compose.server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
networks: [echelon]

server:
image: ghcr.io/aprendendolinux/corujabackup-server:0.0.10
image: ghcr.io/aprendendolinux/corujabackup-server:0.0.11
container_name: corujabackup-server
restart: always
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker compose -f docker-compose.dev.yml up -d --build -> http://187.110.161.52:8081
services:
server:
build: { context: ., target: server, args: { VERSION: "0.0.10" } }
build: { context: ., target: server, args: { VERSION: "0.0.11" } }
container_name: corujabackup-dev-server
restart: unless-stopped
ports: ["8081:8080", "8444:8443"] # 8081 = interface web · 8444 = canal dos agentes
Expand Down
2 changes: 1 addition & 1 deletion docs/TEMAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ O `.zip` é **plano** (sem pastas) e contém:
| Arquivo | Obrigatório | Para quê |
| :--- | :---: | :--- |
| `theme.json` | sim | Manifesto: identificação, cores e referência aos arquivos. |
| logo da interface (ex.: `logo.png`, `logo.svg`) | não | PNG, JPEG, GIF, WebP ou SVG (sem scripts). Cabeçalho e tela de login. |
| logo da interface (ex.: `logo.png`, `logo.svg`) | não | PNG, JPEG, GIF, WebP ou SVG (sem scripts). Cabeçalho, tela de login e ícone da aba do navegador. |
| logo de e-mail/PDF (ex.: `logo.png`) | não | Só **PNG, JPEG ou GIF** (clientes de e-mail e o PDF não renderizam SVG/WebP). Se faltar e a logo da interface for PNG/JPEG/GIF, ela é reaproveitada. |
| `preview.png` | não | Miniatura (apenas informativa). |
| `README.md`, `LICENSE` | não | Ignorados pelo sistema. |
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
package version

// Version é sobrescrita no build: -ldflags "-X github.com/AprendendoLinux/corujabackup/internal/version.Version=1.2.3".
var Version = "0.0.10"
var Version = "0.0.11"

const Name = "Coruja Backup"
4 changes: 2 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# Publicação manual das imagens multi-arquitetura (o fluxo normal é o workflow "Release", disparado pela tag vX.Y.Z).
# Uso: ./scripts/release.sh 0.0.10 (precisa de "docker login ghcr.io" e do buildx)
# Uso: ./scripts/release.sh 0.0.11 (precisa de "docker login ghcr.io" e do buildx)
set -e
V="${1:?informe a versão, ex.: 0.0.10}"
V="${1:?informe a versão, ex.: 0.0.11}"
OWNER="${OWNER:-aprendendolinux}"
cd "$(dirname "$0")/.."
# Segredo do app OAuth padrão do Google (opcional): GOOGLE_CLIENT_SECRET_FILE=/caminho/arquivo ./scripts/release.sh X.Y.Z
Expand Down
Binary file modified themes/clube-naval.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions themes/clube-naval/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"schema": 1,
"id": "clube-naval",
"name": "Clube Naval",
"version": "1.0.0",
"version": "1.1.0",
"author": "Coruja Backup",
"description": "Identidade visual do Clube Naval: fundo claro, azul-marinho do site, dourado do monograma e vinho do brasão.",
"description": "Identidade visual do Clube Naval: fundo claro, botões no vermelho da âncora do brasão e dourado do monograma.",
"colors": {
"bg": "#f5f6f8", "surface": "#ffffff", "text": "#262a33", "muted": "#5f6673", "border": "#dfe3ea",
"primary": "#2b4263", "primary_contrast": "#ffffff", "accent": "#be904e", "ok": "#1f7a4d", "danger": "#aa3335"
"primary": "#aa3335", "primary_contrast": "#ffffff", "accent": "#be904e", "ok": "#1f7a4d", "danger": "#c2410c"
},
"document": { "bg": "#f5f6f8", "text": "#373435", "primary": "#2b4263", "accent": "#be904e", "danger": "#aa3335" },
"document": { "bg": "#f5f6f8", "text": "#373435", "primary": "#aa3335", "accent": "#be904e", "danger": "#c2410c" },
"logo": { "ui": "logo.png", "document": "logo-documento.png" }
}
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "coruja-backup-web",
"private": true,
"version": "0.0.10",
"version": "0.0.11",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
5 changes: 3 additions & 2 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useState } from 'react'
import Logo, { BrandCtx } from './Logo'
import Logo, { BrandCtx, useFavicon } from './Logo'
import { THEMES, applyTheme, savedTheme } from './themes'
import { Agent, Branding, User, api, ApiError, ROLE_LABEL } from './api'
import { Card } from './ui'
Expand Down Expand Up @@ -30,8 +30,9 @@ export default function App() {
const [theme, setTheme] = useState('coruja')
const [phase, setPhase] = useState<Phase>('loading')
const [me, setMe] = useState<Me | null>(null)
const [version, setVersion] = useState('0.0.10')
const [version, setVersion] = useState('0.0.11')
const route = useRoute()
useFavicon(brand)

const loadBrand = useCallback(() => {
fetch('/api/branding').then((r) => r.json()).then((b: Branding) => {
Expand Down
54 changes: 48 additions & 6 deletions web/src/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,51 @@ export const useBrand = () => useContext(BrandCtx)

const activeTheme = () => document.documentElement.getAttribute('data-theme-id') ?? ''

// Endereço da logo em vigor: a do pacote do tema ativo, senão a enviada na página Aparência, senão nenhuma (coruja padrão).
export function logoURL(brand: Branding, themeId: string): string | null {
const pk = brand.themes.find((t) => t.id === themeId)?.pkg
if (pk?.logo_ui) return `/api/branding/themes/${themeId}/logo?v=${pk.asset_ver ?? ''}`
if (brand.has_logo) return `/api/branding/logo?v=${brand.logo_version ?? ''}`
return null
}

function setIcon(href: string, type: string) {
let link = document.querySelector<HTMLLinkElement>('link[rel="icon"]')
if (!link) { link = document.createElement('link'); link.rel = 'icon'; document.head.appendChild(link) }
link.type = type
link.href = href
}

// useFavicon mantém o ícone da aba igual à logo em vigor. A imagem é centralizada num quadrado (logos que não são
// quadradas não ficam distorcidas); sem logo própria, ou se ela não carregar, volta a coruja padrão.
export function useFavicon(brand: Branding) {
useEffect(() => {
let current = 0
const update = () => {
const mine = ++current
const fallback = () => setIcon('/favicon.svg', 'image/svg+xml')
const url = logoURL(brand, activeTheme() || brand.theme)
if (!url) { fallback(); return }
const img = new Image()
img.onload = () => {
if (mine !== current) return // o tema mudou enquanto a imagem carregava
const side = 64, w = img.naturalWidth || side, h = img.naturalHeight || side, k = Math.min(side / w, side / h)
const canvas = document.createElement('canvas')
canvas.width = canvas.height = side
const ctx = canvas.getContext('2d')
if (!ctx) { fallback(); return }
ctx.drawImage(img, (side - w * k) / 2, (side - h * k) / 2, w * k, h * k)
try { setIcon(canvas.toDataURL('image/png'), 'image/png') } catch { fallback() }
}
img.onerror = () => { if (mine === current) fallback() }
img.src = url
}
update()
window.addEventListener('coruja-theme', update)
return () => { current++; window.removeEventListener('coruja-theme', update) }
}, [brand])
}

// Logo: a do pacote do tema ativo, ou a personalizada (enviada na página Aparência), ou a coruja padrão.
export default function Logo({ size = 36 }: { size?: number }) {
const { brand } = useBrand()
Expand All @@ -17,12 +62,9 @@ export default function Logo({ size = 36 }: { size?: number }) {
window.addEventListener('coruja-theme', f)
return () => window.removeEventListener('coruja-theme', f)
}, [])
const pk = brand.themes.find((t) => t.id === tid)?.pkg
if (pk?.logo_ui) {
return <img src={`/api/branding/themes/${tid}/logo?v=${pk.asset_ver ?? ''}`} alt={brand.name} height={size} style={{ height: size, maxWidth: size * 4, objectFit: 'contain' }} />
}
if (brand.has_logo) {
return <img src={`/api/branding/logo?v=${brand.logo_version ?? ''}`} alt={brand.name} height={size} style={{ height: size, maxWidth: size * 4, objectFit: 'contain' }} />
const src = logoURL(brand, tid)
if (src) {
return <img src={src} alt={brand.name} height={size} style={{ height: size, maxWidth: size * 4, objectFit: 'contain' }} />
}
return (
<svg width={size} height={size} viewBox="0 0 64 64" role="img" aria-label={brand.name}>
Expand Down
Loading