Complete LinkSyncServer and LinkSyncExtension implementation

LinkSyncServer:
- Fix app.py imports, add CORS middleware, lifespan events
- Create api/routes.py router aggregator
- Create config/settings.py for centralized configuration
- Rewrite models/base.py with proper relationships and serialization
- Rewrite all API endpoints with real DB integration (auth, links, collections, sync, queries, tags)
- Add admin endpoints (user management, stats, audit log)
- Complete query parser with recursive descent and proper precedence
- Complete query executor with set operations and field filters
- Set up Alembic migrations with initial schema
- Create web interface (templates, CSS, JS)
- Add 42 passing tests (auth, links, collections, queries)
- Add deploy.ps1 and deploy.sh scripts
- Update README with deployment workflow

LinkSyncExtension:
- Create utils/api.js (REST client with retries, auth, error handling)
- Create utils/sync.js (3 sync modes + conflict detection)
- Create utils/collection.js (collection management)
- Create utils/query-engine.js (client-side query parser)
- Rewrite background.js (sync loop, bookmark events, message routing)
- Rewrite popup.js (tabs, settings modal, notifications, CRUD)
- Update popup.html (tabbed interface, query builder, modal)
- Update popup.css (full redesign)
- Create content/content.js (page metadata extraction)
- Create options.html/js (dedicated settings page)
- Generate icons (48x48, 96x96)
- Update manifest.json (host permissions, content scripts, options)
- Create AGENTS.md
This commit is contained in:
DavidSaylor
2026-05-19 13:21:26 -05:00
parent c5d3912070
commit 09d30427f4
54 changed files with 5918 additions and 3177 deletions

View File

@@ -139,6 +139,64 @@ volumes:
docker-compose up -d --build
```
### How `build: .` Works
In `docker-compose.yml`, the `web` service uses `build: .` instead of `image:`. This is a key distinction:
| Key | Behavior |
|-----|----------|
| `image: postgres:15-alpine` | Pulls a pre-built image from Docker Hub |
| `build: .` | Builds a custom image from a `Dockerfile` in the current directory (`.`) |
**The build process works like this:**
```
docker-compose up --build
Reads docker-compose.yml
Finds build: . → looks for Dockerfile in current directory
Executes each instruction in the Dockerfile:
1. FROM python:3.12-slim ← Base image
2. RUN apt-get install curl ← Install system deps
3. COPY requirements.txt . ← Copy dependency list
4. RUN pip install -r ... ← Install Python packages
5. COPY . . ← Copy all project files
6. EXPOSE 5000 ← Declare port
7. CMD ["uvicorn", ...] ← Set startup command
Tags the built image as linksyncserver-web (auto-generated name)
Starts the container from the built image
```
**Why build instead of pull?**
- You're running your own application code, not a third-party image
- Every code change requires a rebuild to take effect
- The `Dockerfile` defines exactly how your app is packaged
**Rebuilding after code changes:**
```bash
# Rebuild and restart (picks up all code changes)
docker-compose up -d --build
# Rebuild without cache (forces fresh pip install)
docker-compose build --no-cache && docker-compose up -d
# Just restart without rebuilding (uses existing image)
docker-compose restart
```
**The `--build` flag:** Forces Docker Compose to rebuild images before starting containers. Without it, Compose reuses any previously built image, meaning your code changes won't be reflected.
### Initial Login
- URL: `http://localhost:5000`
@@ -185,6 +243,93 @@ LinkSyncServer/
└── static/
```
## Deployment
### Deploy Script
The project includes `deploy.ps1` (Windows) and `deploy.sh` (Linux/macOS) to prepare a clean deployment package. These scripts copy only production files, exclude development artifacts (`tests/`, `__pycache__/`, `.git/`, etc.), and create a starter `.env` file.
#### Usage
```powershell
# Windows
.\deploy.ps1 C:\deploy\linksync
```
```bash
# Linux/macOS
chmod +x deploy.sh
./deploy.sh /opt/deploy/linksync
```
#### What Gets Deployed
```
linksync-deploy/
├── .env ← starter file (edit with production secrets)
├── .env.example
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
├── app.py
├── api/
├── models/
├── queries/
├── config/
├── templates/
├── static/
├── alembic/
├── pyproject.toml
├── README.md
├── AGENTS.md
├── design.md
├── tasks.md
└── TODOs.txt
```
#### What Is Excluded
`tests/`, `__pycache__/`, `.pytest_cache/`, `.git/`, `.vscode/`, `*.pyc`, `*.db`, `*.sqlite3`, `node_modules/`, `dist/`, `build/`, and the deploy scripts themselves.
#### Full Deployment Workflow
```bash
# 1. Clone the repository to a temporary location
git clone <repo-url> /tmp/linksync-src
cd /tmp/linksync-src
# 2. Run the deploy script to prepare the package
./deploy.sh /opt/linksync
# 3. Configure production secrets
cd /opt/linksync
nano .env
# Set these values:
# DATABASE_URL=postgresql://user:pass@db:5432/linksync
# SECRET_KEY=<generate with: openssl rand -base64 32>
# ADMIN_PASSWORD=<strong password>
# 4. Build and start
docker-compose up -d --build
# 5. Verify
curl http://localhost:5000/health
# 6. Clean up the source clone
rm -rf /tmp/linksync-src
```
#### Updating an Existing Deployment
```bash
# On the server, pull latest code and redeploy
cd /tmp/linksync-src && git pull
./deploy.sh /opt/linksync
cd /opt/linksync
docker-compose up -d --build
rm -rf /tmp/linksync-src
```
## License
MIT License