History functioning
Each uploaded file is saved into a history file (history.json
). For every entry, the following is stored:
- The URL of the uploaded file
- The upload date and expiration date
- If supported, a "manage" array used for deletion (URL, method, body, headers, and a
formatted
flag) - The original filename
This history is stored locally using Tauri's Rust backend.
π§Ύ Example of a historyβ
history.json
{
"https://gofile.io/d/e2YHue": {
"date_upload": "07/07/2025 7:40 PM",
"date_expires": "07/17/2025 7:40 PM",
"manage": [
"https://api.gofile.io/contents",
"DELETE",
{
"contentsId": "b2f93044-343b-4087-a6f8-9c78d9ae96e0"
},
{
"Authorization": "Bearer API_KEY"
}
],
"filename": "613e986cab42c75bcf21863c84a5b42d.jpg"
},
"https://uploady.io/tsp8o0hu8y3q": {
"date_upload": "07/07/2025 10:55 PM",
"date_expires": "08/06/2025 10:55 PM",
"manage": [
"https://uploady.io",
"POST",
{
"op": "del_file",
"id": "tsp8o0hu8y3q",
"del_id": "lhf3b1wj6y",
"confirm": "yes",
"token": "73cd2a25e0e75806db305e4468f52c8c"
},
{}
],
"filename": "1de1986b16057c600a91c8d248e43515.png"
},
"https://1fichier.com/?7yi4id6xigpdwysc4z8i": {
"date_upload": "07/09/2025 11:33 AM",
"date_expires": "07/24/2025 11:33 AM",
"manage": [
"https://1fichier.com/remove/7yi4id6xigpdwysc4z8i/vLj5dTH6",
"POST",
{
"force": "1"
},
{}
],
"filename": "fd36c2b8872af8ba234b3bf148219a65.jpg"
},
"https://megaup.net/676b3eae2ca78e960b1f2cc77164862b/613e986cab42c75bcf21863c84a5b42d.jpg": {
"date_upload": "07/09/2025 6:39 PM",
"date_expires": "09/07/2025 6:39 PM",
"manage": [
"https://megaup.net/676b3eae2ca78e960b1f2cc77164862b~d?251c4611e53d3f41ce933182cd71ab12",
"POST",
{
"submitted": "1",
"delete": "1",
"returnAccount": "0",
"submit": ""
},
{},
"formatted"
],
"filename": "613e986cab42c75bcf21863c84a5b42d.jpg"
}
}
π§ How it works behind the scenesβ
To interact with the local file system (like reading and writing history.json
), I use Rust with Tauri.
The function responsible for writing a new entry to the history looks like this:
main.rs
#[tauri::command]
fn add_history_json(
newLink: &str,
newUploadDate: &str,
newExpirationDate: &str,
manageLink: &str,
deleteMethod: &str,
deleteParameters: &str,
deleteHeaders: &str,
formattedRequest: &str,
uploadFilename: &str
) {
let history_file_path = "Resources/history.json";
let mut file = File::open(history_file_path.clone()).unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
let mut json: Value = serde_json::from_str(&contents).unwrap();
let data_json_value: Value = serde_json::from_str(deleteParameters).unwrap();
let headers_json_value: Value = serde_json::from_str(deleteHeaders).unwrap();
let new_info = json!({
"date_upload": newUploadDate,
"date_expires": newExpirationDate,
"manage": [manageLink, deleteMethod, data_json_value, headers_json_value, formattedRequest],
"filename": uploadFilename
});
json[newLink] = new_info;
let mut file = OpenOptions::new()
.write(true)
.truncate(true)
.open(history_file_path)
.unwrap();
let json_str = serde_json::to_string_pretty(&json).unwrap();
file.write_all(json_str.as_bytes()).unwrap();
}
π Note: You donβt need to understand Rust to use the app, but this shows how advanced features (like history storage and deletion) are implemented natively for performance and security.
π Want to delete a file later?β
All the information needed for deletion is saved. See this function to understand how the app parses the history and performs deletions.