ark-builders / ark-shelf-desktop Goto Github PK
View Code? Open in Web Editor NEWARK Shelf is where you put your bookmarks during your web surfing. Desktop version.
License: MIT License
ARK Shelf is where you put your bookmarks during your web surfing. Desktop version.
License: MIT License
Shuffling is operation of presenting links to user in random order. Lazy shuffling can be implemented using priority queue.
The idea is to allow user to filter links by tags (we need tag selector like in https://github.com/ARK-Builders/ARK-Navigator/) and also automatically label new links with selected tags. So a query would kinda reflect a session the user work in.
The app should gain CLI flag for running link creation dialog directly, skipping list of existing links:
ark-shelf --add-link
This way it would be possible to bind a hotkey easily for this operation which should be quite common.
Question: what to do if there is already running process of ARK Shelf? Ideally, we should re-use open window.
Extra: we could design the sub-command such a way it would convenient to use it without GUI at all.
Attempt to save https://www.youtube.com/channel/UC8HFOUdnMnpoWmQMgeKoB3A link resulted in the error:
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("yt3.ggpht.com")), port: None, path: "/CajG8KRONNS9zrU0sUb7W3JApVYtYux3dGsV0uSJ8tlbweeCXaNClzZu7KLcLiEa7J-9DV9K=s900-c-k-c0x00ffffff-no-rj", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })) }', core/src/base/link.rs:155:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This will allow a faster development for the frontend. Vitejs is faster, and also the default webbrowser won't be launch each time the tauri dev command is started.
Some pros and cons on the following article
https://blog.logrocket.com/vite-3-vs-create-react-app-comparison-migration-guide/
Would be cool to automatically fetch title and description fields, as well as preview image.
Similar to how the Android app is doing this.
It must be possible to delete any link, both from the list and from the filesystem.
No error raised, simply ignores the entry.
Would suggest to allow entries without the scheme, default to http and handle the result.
An incorrect scheme will save but raises an error with metadata.
A user should be able to sort links by date or by score. Also shuffling would be nice.
The app needs 3-state button, which would cycle sorting modes and reflect current mode by special icon.
Currently using the default tauri one.
Could be replaced with: https://www.ark-builders.dev/apps/shelf.svg
Alphabetical ordering of links doesn't really look useful and should be removed. In its turn, having "unordered" list mode could be useful because it would not spend time on sorting links when user doesn't care about order, e.g. when they use search or filtering by tags.
By "fresh" I mean folders without .ark
subfolder. This means there is any link lacks metadata and preview. Half-initialized folders must be openable, too. In other words, user should be able to copy-paste file externally into the folder and we should catch up with all missing data.
What we do in case a link lacks metadata:
user/properties
, we query OGP and record all required fields into cache/metadata
user/properties
, then we query OGP for missing fields and put them into cache/metadata
user/properties
, then we don't query OGPWhat we do in case a link lacks preview:
cache/previews
We don't really need input fields when we are browsing through list of existing links, so better to hide them and invoke dedicated dialog by clicking a button. The dialog should also be interactive: just 1 input for URL and a button like "paste from buffer". When this input is filled, save
button, as well as title
and description
fields must appear. New inputs must already contain filled-in text (similar to what is done by "autofill" button at the moment). "Autofill" button should be removed. The user can alter contents of title
and description
inputs before saving.
The app must consist of very basic GUI for the start:
.link
files contained in the specified folder.[open]
button, which opens the link in browser.[copy]
button, which copies URL of the link into copy/paste buffer..link
file.[url]
field.[title]
field.[description]
field.[add]
button, which creates .link
file and:The app has to be written in Rust language, so it will be possible to use ArkLib later. GUI framework is up to developer's choice. Qt or Iced should be fine, but other libraries or frameworks can be used as well as soon as they solve the task. The app should be possible to use in macOS. Windows support is nice-to-have.
The app must load missing title or description in background. The link without title or description still should be added into the list, but spinning circles should be used to denote missing fields.
About storage, if the user provided:
.link
file, but we don't store anything in user/properties
.link
file, we store JSON with single field description
title
fieldThe cache/metadata
storage should be used to store automatically fetched title and description, this is as fallback for user/properties
(when 1 or 2 fields are missing). If a title or description is missing in both properties and cache, then we fetch them from the web. If there is no internet connectivity, then spinning circle can be replaced by dedicated "offline" icon.
The preview should use the local data if present. Same as the image. The application should work without online access. A fetch should be done on the LinkCard only if nessecary. (Use timeout for example and listen to the current internet status https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine)
For example user create link with internet access. When offline the description and image preview should still be available
After #2 is implemented, would be cool to have "context" feature allowing to specify certain tags for current session. These tags would be automatically put on all links added during the session.
Some changes could be taken from here:
I expect we have more to adapt in Shelf.
The outcome of parsing the CLI is sent to tauri and then called back from it in multiple places, even though it doesn't change.
Sent to tauri:
builder
.manage(cli)
Pulled back from tauri:
async fn read_link(name: String, state: tauri::State<'_, Cli>) -> Result<LinkWrapper, ()> {
let file_path = format!("{}/{name}", &state.path);
let link = Link::load(&state.path, &file_path).expect(&format!("Error loading {file_path}"));
Really these could just be the global statics rather than state. There's a lazy static macro in use but OnceLock
is also in the standard library now, which could initialise the global.
Which instead would look like:
pub static ARK_SHELF_WORKING_DIR: OnceLock<PathBuf> = OnceLock::new();
pub static SCORES_PATH: OnceLock<PathBuf> = OnceLock::new();
fn main() {
let cli = Cli::parse();
let base_dir = match cli.path {
Ok(path) => PathBuf::from(path),
// This is using platform defaults but otherwise stick with home_dir() + ark-shelf
None => ProjectDirs::from("dev", "Ark Builders", "Shelf-Desktop")
.map_or(PathBuf::from(""), |proj| PathBuf::from(proj.data_dir()))
};
// Initialise global constants
ARK_SHELF_WORKING_DIR.set(base_dir.clone()).expect("Setting Working Dir");
SCORES_PATH.set(base_dir.join("scores")).expect("Setting Scores Path");
}
In any storage containing JSON values, missing title or description should result in an absent field in the JSON. Right now, null
value is written. If all fields are missing, empty JSON must not be written.
null
fieldsLinks should be able to be sorted ascending or descending.
A default need to be chosen. I propose to have a visual indication (color, arrow...) to know which sorting we are on. When clicking again on the sorting button, the mode (ascending/descending) and the visual indication should be updated
Special mode should be possible to invoke by checkbox or something like that.
In this mode, every link in the list should have 3 buttons:
+
increases link's score-
decreases link's score0
resets link's score to zeroBy default, any link has score zero. Score is useful for prioritizing links.
Related feature: #7
The app should gain search bar which would filter links by words in their titles or descriptions.
In case when no path provided for the link storage, $HOME/.ark-shelf
must be used.
UP: This must be a root folder, i.e. it would contain .ark
subfolder with metadata.
ARK-Builders/ARK-Shelf#24
User should get input box highlighted when they paste URL which is already among saved links. Attempt to save such a link should result in an error message, or edit dialog spawned with older version of the link.
Because URLs are pasted into filename.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 36, kind: InvalidFilename, message: "File name too long" }', core/src/base/link.rs:31:44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
We should encode URL with some hash function or BASE 32. We can use UUID or timestamps as well but then we need to check duplicates.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.