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
16 changes: 7 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ docker-compose.yml linguist-language=Dockerfile
# HTML DIR
/cmd/findergen/frontend/** linguist-vendored

/finder-template-generator-ssg/md-linter-plugin.ts linguist-vendored
/finder-template-generator-ssg/vite-pluginbuild-stats.ts linguist-vendored
/finder-template-generator-ssg/pages-ssg-plugin.ts linguist-vendored
# /finder-template-generator-ssg/md-linter-plugin.ts linguist-vendored
# /finder-template-generator-ssg/vite-pluginbuild-stats.ts linguist-vendored
# /finder-template-generator-ssg/pages-ssg-plugin.ts linguist-vendored

/finder-template-generator-ssg/src/pages.d.ts linguist-vendored
/finder-template-generator-ssg/src/jsx-runtime.ts linguist-vendored
/finder-template-generator-ssg/src/jsx.d.ts linguist-vendored
# /finder-template-generator-ssg/src/pages.d.ts linguist-vendored
# /finder-template-generator-ssg/src/jsx-runtime.ts linguist-vendored
# /finder-template-generator-ssg/src/jsx.d.ts linguist-vendored

/finder-template-generator-ssg/src/templates.js linguist-vendored

/finder-template-generator-ssg/public/install.sh linguist-vendored
/npm/site/src/templates.js linguist-vendored

/.obsidian/** linguist-vendored
8 changes: 4 additions & 4 deletions .github/workflows/deploywebpage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ jobs:
with:
node-version: 22
cache: npm
cache-dependency-path: finder-template-generator-ssg/package-lock.json
cache-dependency-path: npm/site/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: finder-template-generator-ssg
working-directory: npm/site

- name: Build static site
run: npm run build:static
working-directory: finder-template-generator-ssg
working-directory: npm/site

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./finder-template-generator-ssg/dist-static
path: ./npm/site/dist-static

deploy:
needs: build
Expand Down
13 changes: 10 additions & 3 deletions internal/bt/gitrepo/gitrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ func restoreZip(archive, destination string) error {
if err := os.MkdirAll(destination, 0755); err != nil {
return err
}
rootAbs, err := filepath.Abs(destination)
if err != nil {
return err
}
for _, file := range reader.File {
if file.Name == "" {
return fmt.Errorf("unsicherer ZIP-Pfad erkannt: %s", file.Name)
Expand All @@ -417,13 +421,16 @@ func restoreZip(archive, destination string) error {
filepath.VolumeName(entryPath) != "" {
return fmt.Errorf("unsicherer ZIP-Pfad erkannt: %s", file.Name)
}
target := filepath.Join(destination, entryPath)
target := filepath.Join(rootAbs, entryPath)
resolved, err := filepath.Abs(target)
if err != nil {
return err
}
root, _ := filepath.Abs(destination)
if resolved != root && !strings.HasPrefix(resolved, root+string(os.PathSeparator)) {
rel, err := filepath.Rel(rootAbs, resolved)
if err != nil {
return err
}
if rel == ".." || strings.HasPrefix(rel, ".."+string(os.PathSeparator)) || filepath.IsAbs(rel) {
return fmt.Errorf("unsicherer ZIP-Pfad erkannt: %s", file.Name)
}
if file.Name == "gitpack.json" {
Expand Down
18 changes: 12 additions & 6 deletions npm/finder-lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ export namespace versions {
export interface Size {
min?: number;
max?: number;
min_size_type?: string;
max_size_type?: string;
min_size_type?: SizeType;
max_size_type?: SizeType;
}

export type Existence = "required" | "forbidden" | "optional";

export type SizeType = "B" | "KB" | "MB" | "GB";
}

/// Version v0.3.16
Expand Down Expand Up @@ -169,8 +171,8 @@ export namespace versions {
export interface Size {
min?: number;
max?: number;
min_size_type?: string;
max_size_type?: string;
min_size_type?: SizeType;
max_size_type?: SizeType;
}

export interface Checksums {
Expand All @@ -179,6 +181,8 @@ export namespace versions {
}

export type Existence = "required" | "forbidden" | "optional";

export type SizeType = "B" | "KB" | "MB" | "GB";
}

/// Version v0.3.17
Expand Down Expand Up @@ -215,8 +219,8 @@ export namespace versions {
export interface Size {
min?: number;
max?: number;
min_size_type?: string;
max_size_type?: string;
min_size_type?: SizeType;
max_size_type?: SizeType;
}

export interface Checksums {
Expand All @@ -225,5 +229,7 @@ export namespace versions {
}

export type Existence = "required" | "forbidden" | "optional";

export type SizeType = "B" | "KB" | "MB" | "GB";
}
}
95 changes: 0 additions & 95 deletions npm/site/public/install.sh

This file was deleted.

19 changes: 15 additions & 4 deletions npm/site/src/configeditor/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,26 @@
function setPath(obj: any, path: string, value: unknown) {
const parts = path.split(".");
const blockedKeys = new Set(["__proto__", "constructor", "prototype"]);
if (parts.some((part) => blockedKeys.has(part))) return;
if (parts.length === 0 || parts.some((part) => blockedKeys.has(part))) return;

let cur = obj;
let cur: any = obj;
for (let i = 0; i < parts.length - 1; i++) {
const p = parts[i];
if (typeof cur[p] !== "object" || cur[p] === null) cur[p] = {};
if (blockedKeys.has(p)) return;
if (typeof cur !== "object" || cur === null) return;

if (!Object.prototype.hasOwnProperty.call(cur, p)) {
cur[p] = Object.create(null);
} else if (typeof cur[p] !== "object" || cur[p] === null) {
cur[p] = Object.create(null);
}
cur = cur[p];
}
cur[parts[parts.length - 1]] = value;

const last = parts[parts.length - 1];
if (blockedKeys.has(last)) return;
if (typeof cur !== "object" || cur === null) return;
cur[last] = value;
}

function readField(input: any): unknown {
Expand Down
29 changes: 24 additions & 5 deletions pub/db/git/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pub/db/git — gitdb

Go-Bibliothek zum Scannen von Git-Repositories über die installierte
Git-CLI und zum Export nach **SQLite** oder **JSON**.
Git-CLI und zum Export nach **SQLite**, **SQL-Dump** oder **JSON**.

## Voraussetzungen

Expand All @@ -24,6 +24,7 @@ func main() {
report, err := gitdb.Export(gitdb.ExportOptions{
RepoPath: "/pfad/zum/repo",
SQLitePath: "export.db", // Optional
SQLPath: "dump.sql", // Optional: SQL-Dump
JSONDir: "./json-export", // Optional
WithBlobs: true, // Blob-Inhalte mit exportieren
LimitCommits: 100, // 0 = unbegrenzt
Expand All @@ -45,6 +46,7 @@ func main() {
| `Export(ExportOptions)` | Scannt Repo + schreibt alle angegebenen Ziele |
| `Snapshot(ExportOptions)` | Scannt Repo, liefert `*RepoData` ohne Export |
| `ExportSQLite(path, data)` | Schreibt `*RepoData` in eine SQLite-DB |
| `ExportSQL(path, data)` | Schreibt `*RepoData` als SQL-Dump (`.sql`) |
| `ExportJSON(dir, data)` | Schreibt `*RepoData` als JSON-Dateien |
| `ReadBlob(dbPath, hash)` | Liest einen dekomprimierten Blob aus der DB |
| `GitVersion()` | Liefert die installierte Git-Version |
Expand All @@ -55,15 +57,14 @@ func main() {
type ExportOptions struct {
RepoPath string // Pfad zum Git-Repository (leer = aktuelles Verzeichnis)
SQLitePath string // Ziel-Datei für SQLite-Export
SQLPath string // Ziel-Datei für SQL-Dump (*.sql)
JSONDir string // Ziel-Verzeichnis für JSON-Export
WithBlobs bool // Blob-Inhalte mit exportieren
LimitCommits int // Max. Anzahl Commits (0 = alle)
}
```

## Datenmodell

### Tabellen (SQLite)
## Datenmodell & SQL-Dump)

| Tabelle | Beschreibung |
| -------------- | ------------------------------------------ |
Expand All @@ -74,6 +75,14 @@ type ExportOptions struct {
| `tree_entries` | Alle Datei-Einträge pro Commit |
| `blobs` | Blob-Objekte (Inhalte gzip-komprimiert) |

Der SQL-Dump (`ExportSQL`) enthält dasselbe Schema wie die SQLite-Tabelle –
als `CREATE TABLE`- und `INSERT`-Statements, gekapselt in `BEGIN`/`COMMIT`.
Blob-Inhalte werden wie in SQLite gzip-komprimiert als hex-Literale
(`X'...'`) geschrieben. Der Dump ist direkt in SQLite importierbar
(`sqlite3 db.sqlite < dump.sql`).
| `tree_entries` | Alle Datei-Einträge pro Commit |
| `blobs` | Blob-Objekte (Inhalte gzip-komprimiert) |

### JSON-Dateien

```
Expand Down Expand Up @@ -108,13 +117,23 @@ report, err := gitdb.Export(gitdb.ExportOptions{

### Nur JSON, alle Referenzen

````

### Nur SQL-Dump

```go
report, err := gitdb.Export(gitdb.ExportOptions{
RepoPath: ".",
SQLPath: "./dump.sql",
WithBlobs: true,
})
```go
report, err := gitdb.Export(gitdb.ExportOptions{
RepoPath: ".",
JSONDir: "./export",
WithBlobs: true,
})
```
````

### Blobs aus SQLite lesen

Expand Down
6 changes: 5 additions & 1 deletion pub/db/git/doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package gitdb ist eine Go-Bibliothek zum Scannen von Git-Repositories
// über die auf dem System installierte Git-CLI und zum Export der
// gescannten Daten nach SQLite oder JSON.
// gescannten Daten nach SQLite, SQL-Dump oder JSON.
//
// # Überblick
//
Expand All @@ -25,6 +25,7 @@
// RepoPath: "./mein-repo",
// SQLitePath: "repo.db",
// JSONDir: "./repo-export",
// SQLPath: "repo.sql",
// WithBlobs: true,
// }
// meta, err := gitdb.Export(opts)
Expand All @@ -40,6 +41,9 @@
// refs, commits, parents, author, committer, tree_entries und blobs.
// Blob-Inhalte können auf Wunsch inline (gzip-komprimiert) gespeichert
// oder nur als Metadaten erfasst werden.
// SQL-Dump (ExportSQL): Eine einzelne .sql-Datei mit demselben Schema,
// als CREATE TABLE- und INSERT-Statements (BEGIN/COMMIT). Direkt in
// SQLite importierbar.
//
// JSON (ExportJSON): Eine Menge von JSON-Dateien im Ausgabeverzeichnis:
//
Expand Down
Loading
Loading