Skip to content

Commit dffb3ef

Browse files
committed
v1.0.0 - Move to selfhost only
1 parent af94bd8 commit dffb3ef

File tree

13 files changed

+138
-44
lines changed

13 files changed

+138
-44
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ browser-extension/web-ext-artifacts
4747

4848
server/symlink.sh
4949
ARCHIVED-browser-extension/
50-
*.ipa
50+
*.ipa
51+
C*.md

README.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Trusty Notes
22

3-
A secure cross-platform note-taking application. Features end-to-end encryption for cloud sync and a modern React frontend.
3+
A secure cross-platform note-taking application designed for self-hosting. Features end-to-end encryption for cloud sync and a modern React frontend.
44

5-
WebApp: https://trustynotes.app
5+
* As of now (v1.0.0) the public instance of trustynotes has been shutdown and moved to a selfhost only project
66

77
Windows/Linux/Android Builds: https://github.com/toolworks-dev/trusty-notes/releases
88

9-
iOS AltStore: https://raw.githubusercontent.com/toolworks-dev/trusty-notes/main/ios/altstore-source.json
10-
119
Vim Mode documentation at: https://github.com/toolworks-dev/trusty-notes/blob/main/docs/vim.md
1210

1311
![image](https://github.com/user-attachments/assets/0d573b72-41af-4851-b90b-d2105bc50286)
@@ -25,25 +23,23 @@ Vim Mode documentation at: https://github.com/toolworks-dev/trusty-notes/blob/ma
2523
- 💾 Import/Export functionality
2624
- 🔒 Seed phrase-based encryption
2725

28-
## To-Do
29-
- [x] Improved Sync
30-
- [x] Rich Text
31-
- [ ] Browser Extension - No longer maintained
32-
- [ ] Attachments/Files
33-
- [x] Desktop Application
34-
- [x] Mobile Application
35-
- [x] Post Quantum Encrpytion
26+
## Self-Hosting Setup
3627

37-
## Client Self-Hosting
28+
### Quick Start
29+
1. **Configure Sync Server**: Edit `src/config/sync.ts` to set your sync server URL
30+
2. **Start Server**: Follow the server setup instructions below
31+
3. **Build Frontend**: Run `bun run build` to create production files
32+
4. **Deploy**: Serve the `dist/` folder or use Docker
3833

39-
### Prerequisites
40-
- Docker
41-
- Docker Compose
34+
See `SELF_HOSTING.md` for detailed configuration instructions.
4235

43-
### Setup & Run
44-
```
45-
git clone https://github.com/toolworks-dev/trusty-notes
46-
cd trusty-notes
36+
### Frontend Build
37+
```bash
38+
# Install dependencies and build
39+
bun install
40+
bun run build
41+
42+
# Or use Docker
4743
docker compose up --build -d
4844
```
4945

SELF_HOSTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Self-Hosting Configuration Guide
2+
3+
This guide explains how to configure TrustyNotes for self-hosting
4+
5+
## Quick Start
6+
7+
1. **Configure Default Sync Server**: Edit `src/config/sync.ts` to set your default sync server
8+
2. **Start Your Sync Server**: Use the provided server in the `server/` directory
9+
3. **Build and Deploy**: Build the frontend and deploy to your chosen platform
10+
11+
## Configuration
12+
13+
### Frontend Configuration
14+
15+
Edit `src/config/sync.ts` to configure your default sync servers:
16+
17+
```typescript
18+
export const DEFAULT_SYNC_SERVERS: SyncServerConfig[] = [
19+
{
20+
label: 'My Self-Hosted Server',
21+
value: 'https://sync.mydomain.com',
22+
isDefault: true
23+
},
24+
{
25+
label: 'Local Development',
26+
value: 'http://localhost:3222',
27+
isDefault: false
28+
},
29+
];
30+
```
31+
32+
### Server Setup
33+
34+
1. Navigate to the `server/` directory
35+
2. Create a `.env` file with your MongoDB credentials:
36+
```
37+
MONGO_USERNAME=your_username
38+
MONGO_PASSWORD=your_password
39+
```
40+
3. Start the server:
41+
```bash
42+
docker compose up --build -d
43+
```
44+
45+
### Android
46+
Update `android/app/build.gradle` if you want to change the default server for Android builds:
47+
```gradle
48+
resValue "string", "server_url", "https://your-sync-server.com"
49+
```

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ android {
88
minSdkVersion rootProject.ext.minSdkVersion
99
targetSdkVersion rootProject.ext.targetSdkVersion
1010
versionCode 2
11-
versionName "0.8.2"
11+
versionName "1.0.0"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
aaptOptions {
1414
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
1515
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
1616
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
1717
}
18-
resValue "string", "server_url", "https://sync.trustynotes.app"
18+
resValue "string", "server_url", "http://localhost:3222"
1919
resValue "color", "colorPrimary", "#3366FF"
2020
resValue "color", "colorPrimaryDark", "#1A1B1E"
2121
resValue "color", "colorAccent", "#5288FF"

desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "trusty-notes-electron",
3-
"version": "0.8.2",
3+
"version": "1.0.0",
44
"main": "main.js",
55
"type": "commonjs",
66
"description": "TrustyNotes is a simple, secure, and reliable note-taking app",

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"name": "trusty-notes-web",
33
"private": true,
4-
"version": "0.8.2",
4+
"version": "1.0.0",
55
"type": "module",
66
"description": "TrustyNotes is a simple, secure, and reliable note-taking app",
77
"author": "Toolworks.dev",
88
"scripts": {
99
"dev": "vite",
1010
"build": "tsc && vite build",
1111
"preview": "vite preview",
12-
"build:electron": "cross-env ELECTRON=true tsc && vite build && node desktop/build.js",
12+
"build:electron": "cross-env ELECTRON=true tsc && vite build && bun desktop/build.js",
1313
"start:electron": "cd desktop && electron .",
1414
"dev:electron": "concurrently \"vite\" \"cd desktop && cross-env NODE_ENV=development electron .\"",
15-
"build:chrome": "bun browser-extension/build.js chrome",
16-
"build:firefox": "bun browser-extension/build.js firefox",
1715
"dist:linux": "bun run build:electron && cd desktop && bun run build:linux",
1816
"dist:windows": "bun run build:electron && cd desktop && bun run build:windows",
1917
"dist:all": "bun run build:electron && cd desktop && bun run build:all",

src/components/SyncSettings.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@ import { WebStorageService } from '../services/webStorage';
2020
import { SyncSettings as SyncSettingsType } from '../types/sync';
2121
import { CryptoService } from '../services/cryptoService';
2222
import { ApiService } from '../services/apiService';
23+
import { getAvailableSyncServers, getDefaultSyncServer } from '../config/sync';
2324
//import { NumberInput } from '@mantine/core';
2425

25-
const DEFAULT_SERVERS = [
26-
{ label: 'Official Server', value: 'https://sync.trustynotes.app' },
27-
{ label: 'Local Server', value: 'http://localhost:3222' },
28-
];
29-
3026
interface SyncSettingsProps {
3127
onSync?: () => Promise<void>;
3228
onClose?: () => void;
@@ -38,7 +34,7 @@ export function SyncSettings({ onSync, onClose }: SyncSettingsProps) {
3834
const [showNewSeedPhrase, setShowNewSeedPhrase] = useState(false);
3935
const [newSeedPhrase, setNewSeedPhrase] = useState('');
4036
const [syncing, setSyncing] = useState(false);
41-
const [selectedServer, setSelectedServer] = useState(DEFAULT_SERVERS[0].value);
37+
const [selectedServer, setSelectedServer] = useState(getDefaultSyncServer());
4238
const [customServers, setCustomServers] = useState<string[]>([]);
4339
const [newServerUrl, setNewServerUrl] = useState('');
4440
const [showAddServer, setShowAddServer] = useState(false);
@@ -112,7 +108,7 @@ export function SyncSettings({ onSync, onClose }: SyncSettingsProps) {
112108
}
113109

114110
if (customServers.includes(newServerUrl) ||
115-
DEFAULT_SERVERS.some(s => s.value === newServerUrl)) {
111+
getAvailableSyncServers().some(s => s.value === newServerUrl)) {
116112
notifications.show({
117113
title: 'Error',
118114
message: 'Server already exists',
@@ -151,7 +147,7 @@ export function SyncSettings({ onSync, onClose }: SyncSettingsProps) {
151147
await saveSettings({ custom_servers: updatedServers });
152148

153149
if (selectedServer === serverUrl) {
154-
const newServer = DEFAULT_SERVERS[0].value;
150+
const newServer = getDefaultSyncServer();
155151
setSelectedServer(newServer);
156152
await saveSettings({ server_url: newServer });
157153
}
@@ -236,7 +232,7 @@ export function SyncSettings({ onSync, onClose }: SyncSettingsProps) {
236232
};
237233

238234
const serverOptions = [
239-
...DEFAULT_SERVERS,
235+
...getAvailableSyncServers(),
240236
...customServers.map(url => ({
241237
label: url,
242238
value: url,

src/components/SyncSetup.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState } from 'react';
22
import { Button, Stack, Text, PasswordInput } from '@mantine/core';
33
import { notifications } from '@mantine/notifications';
44
import { WebStorageService } from '../services/webStorage';
5+
import { getDefaultSyncServer } from '../config/sync';
56

67
interface SyncSetupProps {
78
onSync?: () => Promise<void>;
@@ -23,11 +24,12 @@ export function SyncSetup({ onSync }: SyncSetupProps) {
2324

2425
try {
2526
setStatus('syncing');
27+
const defaultServer = getDefaultSyncServer();
2628
await WebStorageService.initializeCrypto(seedPhrase);
27-
await WebStorageService.syncWithServer('https://sync.trustynotes.app');
29+
await WebStorageService.syncWithServer(defaultServer);
2830
await WebStorageService.saveSyncSettings({
2931
seed_phrase: seedPhrase,
30-
server_url: 'https://sync.trustynotes.app',
32+
server_url: defaultServer,
3133
auto_sync: false,
3234
sync_interval: 5,
3335
custom_servers: []

src/config/sync.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Sync configuration for TrustyNotes
3+
* Configure default sync servers here for self-hosting
4+
*/
5+
6+
export interface SyncServerConfig {
7+
label: string;
8+
value: string;
9+
isDefault?: boolean;
10+
}
11+
12+
/**
13+
* Default sync servers configuration
14+
* Modify these values for your self-hosted setup
15+
*/
16+
export const DEFAULT_SYNC_SERVERS: SyncServerConfig[] = [
17+
{
18+
label: 'Local Server',
19+
value: 'http://localhost:3222',
20+
isDefault: true
21+
},
22+
// Add more default servers here as needed
23+
// {
24+
// label: 'My Self-Hosted Server',
25+
// value: 'https://sync.mydomain.com',
26+
// isDefault: false
27+
// },
28+
];
29+
30+
/**
31+
* Get the default sync server URL
32+
* Returns the first server marked as default, or the first server if none are marked
33+
*/
34+
export function getDefaultSyncServer(): string {
35+
const defaultServer = DEFAULT_SYNC_SERVERS.find(server => server.isDefault) || DEFAULT_SYNC_SERVERS[0];
36+
return defaultServer?.value || 'http://localhost:3222';
37+
}
38+
39+
/**
40+
* Get all available default sync servers
41+
*/
42+
export function getAvailableSyncServers(): SyncServerConfig[] {
43+
return DEFAULT_SYNC_SERVERS;
44+
}
45+
46+
/**
47+
* Check if a URL is in the default servers list
48+
*/
49+
export function isDefaultSyncServer(url: string): boolean {
50+
return DEFAULT_SYNC_SERVERS.some(server => server.value === url);
51+
}

src/service-worker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const ASSETS_TO_CACHE = [
3131
'https://raw.githubusercontent.com/toolworks-dev/trusty-notes/main/trusty-notes.png'
3232
];
3333

34-
const API_ROUTES = [
35-
'https://sync.trustynotes.app'
36-
];
34+
// API routes are now configurable in src/config/sync.ts
35+
// The service worker will not cache sync server requests
36+
const API_ROUTES = [];
3737

3838
self.addEventListener('install', (event) => {
3939
event.waitUntil(

0 commit comments

Comments
 (0)