Skip to content

Commit 34ecd76

Browse files
committed
implemented flask
1 parent f73d742 commit 34ecd76

5 files changed

Lines changed: 122 additions & 175 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ __pycache__/
1313
*$py.class
1414
*.so
1515
.Python
16-
env/
1716
venv/
18-
.env
17+
env/
18+
.venv
1919

2020
# IDE
2121
.vscode/

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM python:3.9-slim
33
# Set working directory
44
WORKDIR /app
55

6+
# Install Python dependencies
7+
RUN pip install --no-cache-dir flask requests urllib3
8+
69
# Copy application files
710
COPY index.html .
811
COPY styles.css .
@@ -15,5 +18,5 @@ RUN mkdir -p config
1518
# Expose port
1619
EXPOSE 8595
1720

18-
# Run the server
21+
# Run the Flask server
1922
CMD ["python", "server.py"]

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A more compact home page dashboard style view for browsing your [KaraKeep](https
1010
- 🔍 **Real-time Search** - Instantly filter bookmarks as you type
1111
- 🖱️ **Drag & Drop** - Reorder lists to your preference
1212
- 📱 **Responsive** - Works beautifully on desktop, tablet, and mobile
13-
- 🔌 **API Integration** - Connects directly to KaraKeep via API
13+
- 🔌 **API Integration** - Connects to KaraKeep via API with built-in CORS proxy
1414
- 🔒 **Privacy-First** - Uses your own KaraKeep instance and API key
1515

1616
## Quick Start with Docker
@@ -55,7 +55,7 @@ nano ./config/config.json
5555
## Manual Installation
5656

5757
### Prerequisites
58-
- Python 3.7+ (for the server)
58+
- Python 3.7+ with Flask
5959
- A running KaraKeep instance
6060
- Your KaraKeep API key
6161

@@ -67,18 +67,24 @@ git clone https://github.com/codejawn/karakeep-homedash.git
6767
cd karakeep-homedash
6868
```
6969

70-
2. Start the server:
70+
2. Install Python dependencies:
71+
```bash
72+
pip install -r requirements.txt
73+
# or manually: pip install flask requests urllib3
74+
```
75+
76+
3. Start the server:
7177
```bash
7278
python server.py
7379
```
7480

75-
3. Edit the config file:
81+
4. Edit the config file:
7682
```bash
7783
# Edit config/config.json and add your KaraKeep API key
7884
nano config/config.json
7985
```
8086

81-
4. Open http://localhost:8595 in your browser
87+
5. Open http://localhost:8595 in your browser
8288

8389
## Configuration
8490

@@ -120,11 +126,14 @@ The application uses a `config/config.json` file for settings. On first run, a d
120126
For development without Docker:
121127

122128
```bash
123-
# Start the development server
129+
# Install dependencies
130+
pip install -r requirements.txt
131+
132+
# Start the Flask development server
124133
python server.py
125134

126-
# Or use any static file server if you don't need preference persistence
127-
python -m http.server 8595
135+
# For development with auto-reload
136+
FLASK_ENV=development python server.py
128137
```
129138

130139
### Making Changes
@@ -139,6 +148,8 @@ KaraKeep HomeDash uses the following KaraKeep API endpoints:
139148
- `GET /api/lists` - Fetch all bookmark lists
140149
- `GET /api/bookmarks` - Fetch all bookmarks
141150

151+
The Flask server includes a built-in proxy that forwards these requests to avoid CORS issues when running on different domains.
152+
142153
## Troubleshooting
143154

144155
### "Invalid API key"
@@ -151,10 +162,16 @@ KaraKeep HomeDash uses the following KaraKeep API endpoints:
151162
- Check browser console for errors
152163
- Ensure you have bookmarks in your KaraKeep instance
153164

165+
### CORS errors
166+
- The Flask server includes a built-in proxy to handle CORS issues
167+
- Make sure you're using the Flask server (`server.py`) and not a basic HTTP server
168+
- The proxy automatically forwards requests to your KaraKeep instance
169+
154170
### Connection errors
155171
- Check that KaraKeep is running and accessible at the configured URL
156172
- Ensure there are no firewall or network issues
157173
- If using Docker, make sure the containers can communicate
174+
- For self-signed certificates, the proxy is configured to accept them
158175

159176
### Drag and drop not saving
160177
- The config directory must be writable

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
flask==3.0.0
2+
requests==2.31.0
3+
urllib3==2.1.0

0 commit comments

Comments
 (0)