-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog.txt
100 lines (95 loc) · 4.55 KB
/
log.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
sq/sq.go
stacktrace/stacktrace.go
schema.go
id.go
object_storage.go
fs.go
fs_directory.go
fs_database.go
fs_sftp.go
fs_replicated.go
mailer.go
creation_time.go
creation_time_darwin.go
creation_time_linux.go
creation_time_windows.go
embed/*
static/*
notebrew.go
developer_mode.go
internal/highlighting/highlighting.go
internal/highlighting/markdownmath.go
site_generator.go
site_json.go
postlist_json.go
rootdirectory.go
directory.go
image.go
createsite.go
deletesite.go
createfolder.go
createfile.go
delete.go
search.go
rename.go
uploadfile.go
clipboard.go
applytheme.go
calculatestorage.go
cancelexport.go
cancelimport.go
changepassword.go
createsession.go
deletesession.go
export.go
exports.go
import.go
imports.go
invite.go
login.go
logout.go
pin.go
profile.go
resetpassword.go
resettheme.go
unpin.go
updateemail.go
updateprofile.go
serve_http.go
cli/config_cmd.go
cli/cli.go
cli/createinvite_cmd.go
cli/createsite_cmd.go
cli/createuser_cmd.go
cli/deleteinvite_cmd.go
cli/deletesite_cmd.go
cli/deleteuser_cmd.go
cli/hashpassword_cmd.go
cli/permissions_cmd.go
cli/resetpassword_cmd.go
cli/sqlite_cgo.go
cli/sqlite_nocgo.go
cli/start_cmd.go
cli/status_cmd.go
cli/stop_cmd.go
notebrew/main.go
gui/main.go
TODO: /files/lookup/?fileID=abcde => [{"fileID":"","filePath":"","creationTime":"",...}]
- when smart client enters a directory, it loads entries from its local database and makes a call to directories.go at the same time using the same view params.
- for each deleted file, it calls files/lookup/fileID=xxxx in order to find if the file was deleted or just moved. if it was deleted, move it to the trash. if it was moved, create a new file entry.
- if the deleted file is a folder, oh my god we need to recurse into the folder and do the same for *all* its children. recursively. this will take up a lot of time for what was supposed to be a simple directory visit. hopefully we will rarely encounter this because most missing files should be straight up deleted.
- actually, no. we don't have to do this recursively. we can short-circuit/shortcut this by checking if the destination path exists. If it doesn't, we can simply move the entire folder over (this is because folders also have fileIDs! if a folder with a fileID turns up at a different filePath, we can assume it was moved over).
- for each added file, it adds a new file entry to the local database (but with NULL content).
TODO: change sq to use Go 1.23's range over iterator funcs (we will need to drastically change the error handling of all code that uses a cursor).
TODO: add database test scaffolding (you don't need to write all tests for all handlers yet, but you need to establish what a test scaffolding that goes through all database dialects would look like).
TODO: add ability to showcase blogs on the site? add ability to showcase posts and vote on posts?
mobile app: when you share a social media post (twitter threads reddit), you are given the option to create a new file or append to an existing file. when you append, a "----" is added before appending the rest of the contents.
mobile app: separate the local file handling code and the server sync code with an events system. when a file is created updated deleted copied or moved, an event is emitted and the server synchronisation code kicks in. the local file handling code never has any idea it is communicating with an external server. things just magically appear and disappear in the database.
look into creating an offline-first app
- dumb server, smart client
- every file has a modTime and a serverModTime. The serverModTime is compared with the modTime from the server (together with the file hash) to determine if a file has gone out of sync with the server. If so, the latest copy will always take the place of the filename and the older copy will occupy the filename <filename>-YYYY-MM-DD-HHMMSS-<base32UUIDHash>.<ext>.
- each folder has a "lastSynced" timestamp. The user can see this and choose to sync a folder at any time, which kicks off a background job that iterates through the server-side folder using JSON API calls.
- if a file/folder was deleted on the server, move it to the recycling bin in the client
- if a file/folder was added on the server, pull it into the client.
- if a file was changed on the server, compare the file
- it is always up to the client to pull the latest changes. the server never pushes updates to the client (because it is dumb and has no idea the clients exist). if the user never updates a folder, they will never see new files added on the server. the user must have some clue whether or not new files or changes