Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
c7a2691
Add inherited_from column to Files_Tags and Folders_Tags tables (#120)
Copilot Nov 15, 2025
3529e65
Revert "Add inherited_from column to Files_Tags and Folders_Tags tabl…
ploiu Nov 15, 2025
40fca71
direct tag migration step
ploiu Nov 15, 2025
1506fc6
start of flattening tags
ploiu Nov 15, 2025
7d72b56
v6 database migration
ploiu Nov 15, 2025
578755a
Initial plan
Copilot Nov 15, 2025
f358bfa
Move tag functionality to tags module
Copilot Nov 15, 2025
177f64c
Use super imports for better module organization
Copilot Nov 15, 2025
aea2f50
Add handler tests for tag endpoints
Copilot Nov 15, 2025
e59639c
Use crate:: instead of super::super::super:: for cleaner imports
Copilot Nov 15, 2025
22d703e
Move client() and set_password() helpers to shared test utilities
Copilot Nov 15, 2025
2c06c6c
Organize handler tests by endpoint and use AUTH constant
Copilot Nov 15, 2025
f387a1e
Merge pull request #123 from ploiu/copilot/move-tag-functionality-module
ploiu Nov 15, 2025
d2a2d80
no longer use old tag tables
ploiu Nov 15, 2025
910b4d1
simplify tag search
ploiu Nov 15, 2025
bf605e6
start of using TaggedItem in the codebase
ploiu Nov 16, 2025
970b7db
more progress on tag changes
ploiu Nov 17, 2025
f0973ec
get the code to compile
ploiu Nov 19, 2025
17c1202
stub function
ploiu Nov 19, 2025
4a4b7f7
Initial plan
Copilot Nov 20, 2025
d09c95c
Implement tag propagation for folder descendants
Copilot Nov 20, 2025
917fd25
Remove unused helper functions and SQL files
Copilot Nov 20, 2025
ae2b783
Address code review feedback: use existing folder_repository function…
Copilot Nov 20, 2025
dfd0504
Fix logic to preserve closest explicit tag inheritance
Copilot Nov 20, 2025
7e766ea
some updates
ploiu Nov 21, 2025
6318551
Extract delete operations into separate functions with tests
Copilot Nov 21, 2025
f096578
some updates
ploiu Nov 22, 2025
ac98d29
some refactoring
ploiu Nov 22, 2025
a7abdcf
some more heavy refactoring
ploiu Nov 23, 2025
8de0281
rewrite most of copilot's garbage
ploiu Nov 23, 2025
6c926c6
Update src/tags/repository.rs
ploiu Nov 23, 2025
2b72825
Update src/tags/repository.rs
ploiu Nov 23, 2025
1ae2e4d
Update src/tags/repository.rs
ploiu Nov 23, 2025
738a8d4
Update src/tags/service.rs
ploiu Nov 23, 2025
6a1c296
Update src/tags/repository.rs
ploiu Nov 23, 2025
e575742
Change get_all_child_folder_ids to accept &[u32] instead of IntoIterator
Copilot Nov 23, 2025
bb7e6cd
Merge pull request #129 from ploiu/copilot/add-remove-direct-tag-fold…
ploiu Nov 23, 2025
f4fd325
Initial plan
Copilot Nov 24, 2025
ab7e399
Implement folder move implicit tag recalculation
Copilot Nov 24, 2025
a75399d
Refactor: Extract folder move tag handling to separate function
Copilot Nov 24, 2025
9dbd14f
Add tests for unaffected folders/files and fix tag removal logic
Copilot Nov 24, 2025
b5780fe
some cleanup
ploiu Nov 24, 2025
eeccaf9
add more tests
ploiu Nov 24, 2025
5c0da8e
some cleanup
ploiu Nov 24, 2025
59116a7
rewrite batch update function
ploiu Nov 24, 2025
d6662aa
Merge pull request #131 from ploiu/copilot/fix-folder-parentid-change
ploiu Nov 24, 2025
358f0d3
some cleanup
ploiu Nov 24, 2025
45dd173
Initial plan
Copilot Nov 24, 2025
8e23fb1
Add file_repository::get_all_ancestors function with tests
Copilot Nov 24, 2025
0fc5f89
Add service layer functions for tag re-evaluation on file move
Copilot Nov 24, 2025
25ab9e7
Add comprehensive tests for file move tag re-evaluation
Copilot Nov 24, 2025
beb230c
Fix outdated comment in update_file function
Copilot Nov 24, 2025
d59f61d
Address code review nitpicks - improve code clarity
Copilot Nov 24, 2025
65d7ca5
Address PR review feedback: clean up comments, reuse connections, add…
Copilot Nov 24, 2025
cc76806
Refactor add_implicit_tags_to_files to follow batch_remove_implicit_t…
Copilot Nov 24, 2025
6243377
revert cc76806b5f78b792ecb1eb1a53f46717ed4965e0
ploiu Nov 24, 2025
3f6ae8a
some performance fixes
ploiu Nov 24, 2025
bb98c8c
Merge pull request #133 from ploiu/copilot/update-file-parent-folder-…
ploiu Nov 24, 2025
e95be8d
fix test compile errors
ploiu Nov 24, 2025
2ecd47f
updating file no longer sets implied tags as explicit
ploiu Nov 25, 2025
7421d74
fix bug where files are sticky with their implied tags
ploiu Nov 25, 2025
98f5fe6
saving file implicates tags from parents
ploiu Nov 25, 2025
0a31792
fix file tests, create folder implicates tags
ploiu Nov 25, 2025
dc0e28b
update docs and version
ploiu Nov 25, 2025
ba7fa44
clippy
ploiu Nov 25, 2025
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
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \
ffmpeg \
sqlite3 \
rsync \
less \
&& rm -rf /var/lib/apt/lists/* \
# for cross compilation with raspberry pi
&& rustup target add aarch64-unknown-linux-gnu \
Expand Down
68 changes: 52 additions & 16 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ folders indexed by a database and accessible via an api layer.
# Hardware / OS

designed primarily with linux in mind. Specifically a headless raspberry pi.
Currently runs flawlessly on a 3B. Windows _might_ work for some stuff, but
supporting it is not a priority
Currently runs flawlessly on a 3B. Windows support is not a priority.

# General structure

Expand All @@ -31,10 +30,10 @@ supporting it is not a priority
- src/assets/* - contains non-rust assets used via `include_str!`; mainly sql
files
- src/assets/migration/* - database migration files
- src/assets/queries/* - general-purpose sqlite3 files
- src/assets/queries/* - general-purpose sqlite3 files, split out into
categories based on what the queries touch
- src/assets/init.sql - database initialization
- src/model/* - dumping ground for all models. Needs to be split out. No
newly-created models should be put here (see the section `Organization` below)
- src/model/* - dumping ground for all models. Needs to be split out.
- src/previews/* - all file preview functionality. Currently takes the first
step outlined in the `Organization` section below
- src/queue/* - all queueing functionality. Might need to be refactored later
Expand All @@ -51,6 +50,43 @@ supporting it is not a priority
is compared with the latest upgrade version and upgrades are applied
accordingly.

not everything follows this pattern, however. Refer to the `Structure Migration`
section for any new changes

## Structure Migration

in an attempt to modularize the codebase and better organize it, All new changes
need to be organized like this:

- src/<module_name>: the name of the general functionality
- handler.rs (optional): endpoint functions for use with rocket
- repository.rs: database layer interactions
- service.rs: main logic layer of the feature
- tests: tests for the feature
- handler.rs/repository.rs/service.rs: tests for the respective layer of
this feature
- <name>.rs: tests for any other file in the feature module folder

each function should get its own `mod` in the respective test file. If more than
10 tests exist for the same function, it should be pulled out into its own test
file alongside the other test files for that module

### Example

```
- src
- tags
- handler.rs
- mod.rs
- repository.rs
- service.rs
- tests
- handler.rs
- mod.rs
- repository.rs
- service.rs
```

# Queue

hardware strength is limited, and generating previews takes about ~1 second on
Expand All @@ -59,17 +95,6 @@ hit for a user-defined amount of time (defaults to 30 seconds).
`file_preview_consumer` is called in src/main.rs to set this up. All queue
functionality is disabled during tests

# Organization

the project was originally organized after general java+spring organization -
controller/handler layer, repository layer, service layer, etc. However that has
proven to not _really_ work with how I organize stuff. Going forward, I'd like
to use cargo workspaces to split out everything into its own crate (e.g. the
file handler, service layer, repository layer, and models all go in a specific
crate, same for folders, etc). Until then though, everything is in the same
crate and will be slowly migrated to models and _then_ crates to make the
migration easier

# Testing

general test structure takes this format (pulled from code snippets in
Expand Down Expand Up @@ -133,3 +158,14 @@ instead do this:
let x = 1;
format!("x: {x}");
```

## On the `use` statement

it's heavily preferred that `use` be declared at the top of the module. Rarely
should `use` be used in the top of a function. Under _**NO CIRCUMSTANCES**_
should `use` be used in the middle of a function.

# Sql files

each sql file needs to be associated with a repository-layer function with the
same name
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commentTranslate.hover.enabled": true,
"chat.agent.enabled": true,
"chat.commandCenter.enabled": false,
"chat.notifyWindowOnConfirmation": false,
"telemetry.feedback.enabled": false,
"deno.enable": false
"deno.enable": false,
"sql-formatter.uppercase": false
}
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "file_server"
version = "3.0.3"
version = "4.0.0"
edition = "2024"
authors = ["Ploiu"]

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ turn off this feature, set `RabbitMq.enabled` to `false` in `FileServer.toml`

## notes

generating file previews requires rabbitmq to be running _when this application starts_. Timing can vary depending on your device, but here's an example script
generating file previews requires rabbitmq to be running _when this application
starts_. Timing can vary depending on your device, but here's an example script
that can guide you in booting up properly (works great in `/etc/rc.local`):

```shell
Expand All @@ -83,4 +84,5 @@ sudo rabbitmq-server &
sleep 45
sudo rabbitmqctl await_online_nodes 1 && $(./sudo file_server &) &
```
you can also use `systemd` to ensure this launches after rabbit

you can also use `systemd` to ensure this launches after rabbit
34 changes: 24 additions & 10 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"title": "Ploiu File Server",
"description": "a self-hostable file server written in rust",
"version": "3.0.3"
"version": "4.0.0"
},
"paths": {
"/api/version": {
Expand Down Expand Up @@ -1100,7 +1100,7 @@
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/tagApi"
"$ref": "#/components/schemas/taggedItemApi"
}
},
"size": {
Expand Down Expand Up @@ -1130,13 +1130,6 @@
"type": "number",
"nullable": true,
"minimum": 0
},
"tags": {
"nullable": false,
"type": "array",
"items": {
"$ref": "#/components/schemas/tagApi"
}
}
}
},
Expand Down Expand Up @@ -1218,12 +1211,13 @@
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/tagApi"
"$ref": "#/components/schemas/taggedItemApi"
}
}
}
},
"tagApi": {
"description": "an individual tag",
"properties": {
"id": {
"nullable": true,
Expand All @@ -1236,6 +1230,26 @@
}
}
},
"taggedItemApi": {
"description": "a tag as it exists on a file or a folder",
"properties": {
"id": {
"nullable": true,
"type": "number",
"minimum": 0,
"description": "the id of the tag itself"
},
"title": {
"type": "string",
"nullable": false
},
"implicitFrom": {
"type": "number",
"nullable": true,
"description": "the folder that owns this tag and is implicating this tag. If null, the file / folder explicitly has this tag on itself. tags with an implicitFrom cannot be manually removed from the file / folder"
}
}
},
"createPassword": {
"properties": {
"username": {
Expand Down
Loading