aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--TODO6
-rw-r--r--example-config.json18
-rw-r--r--include/Config.hpp6
-rwxr-xr-xinstall.sh3
-rw-r--r--src/Config.cpp44
-rw-r--r--src/QuickMedia.cpp20
-rw-r--r--src/plugins/Saucenao.cpp1
8 files changed, 84 insertions, 16 deletions
diff --git a/README.md b/README.md
index 97c89de..cf1d131 100644
--- a/README.md
+++ b/README.md
@@ -167,7 +167,7 @@ Type text and then wait and QuickMedia will automatically search.\
`/react [text]`: React to the selected message (also works if you are replying to a message).\
`/id`: Show the room id.
## Config
-Config is loaded from `~/.config/quickmedia/config.json` if it exists. See [example-config.json](https://git.dec05eba.com/QuickMedia/plain/example-config.json) for an example config. All fields in the config file are optional.\
+Config is loaded from `~/.config/quickmedia/config.json` if it exists. See [example-config.json](https://git.dec05eba.com/QuickMedia/plain/example-config.json) for an example config. All fields in the config file are optional. If you have installed quickmedia then you can copy `/usr/share/quickmedia/example-config.json` to `~/.config/quickmedia/config.json` and use that as a base for your personal config file.\
If `use_system_mpv_config` is set to `true` then your systems mpv config in `~/.config/mpv/mpv.conf` and plugins will be used.
## Theme
Theme is loaded from `~/.config/quickmedia/themes/<theme-name>.json` if it exists or from `/usr/share/quickmedia/themes`. Theme name is set in `~/.config/quickmedia/config.json` under the variable `theme`.\
diff --git a/TODO b/TODO
index 9500678..ef5e678 100644
--- a/TODO
+++ b/TODO
@@ -228,4 +228,8 @@ To make quickmedia more resilient against broken youtube videos, quickmedia shou
Make youtube work with age restricted copy righted videos, such as https://www.youtube.com/watch?v=7n3dP_1KqBw. Age restricted videos also play slowly because they have url part that needs to be decoded.
Upload media once in 4chan, on comment enter and then re-use that after solving captcha; instead of reuploading video after each captcha retry. If possible...
Support migration from one manga service to another, automatically by selecting the manga to migrate from which service (or select all). Also do that in automedia. Give error if it's not possible to do automatically and show option to manually select the matching manga/chapter. Quickmedia should also be able to automatically migrate automedia in the same process or a separate option.
-Instead of having an option to disable rounded corners, add an option to set corner radius where radius=0 means disabling the shader. \ No newline at end of file
+Instead of having an option to disable rounded corners, add an option to set corner radius where radius=0 means disabling the shader.
+Support proper emoji, maybe a different emoji per image.
+Consider adding an option to use external sxiv, imv etc instead of mpv/quickmedia image viewer.
+Fallback to playing videos/etc from origin homeserver in matrix if the file is larger than the users homeserver allows. This wont work with pantalaimon + encrypted rooms, so it should be delayed until quickmedia supports matrix encryption.
+Fix 4chan posting! cloudflare broke shit. Then create external captcha solver program that solves captcha from captcha image. \ No newline at end of file
diff --git a/example-config.json b/example-config.json
index 49f83eb..c489a15 100644
--- a/example-config.json
+++ b/example-config.json
@@ -34,6 +34,24 @@
"youtube": {
"load_progress": true
},
+ "matrix": {
+ "known_homeservers": [
+ "midov.pl",
+ "matrix.org",
+ "kde.org",
+ "librem.one",
+ "maunium.net",
+ "halogen.city",
+ "gnome.org",
+ "shivering-isles.com",
+ "nerdsin.space",
+ "glowers.club",
+ "privacytools.io",
+ "linuxdelta.com",
+ "tchncs.de",
+ "jupiterbroadcasting.com"
+ ]
+ },
"use_system_fonts": false,
"use_system_mpv_config": false,
"enable_shaders": true,
diff --git a/include/Config.hpp b/include/Config.hpp
index 101b0be..6aabc65 100644
--- a/include/Config.hpp
+++ b/include/Config.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <vector>
namespace QuickMedia {
struct SearchConfig {
@@ -46,6 +47,10 @@ namespace QuickMedia {
bool load_progress = true;
};
+ struct MatrixConfig {
+ std::vector<std::string> known_homeservers;
+ };
+
struct Config {
Config() = default;
Config(const Config&) = delete;
@@ -59,6 +64,7 @@ namespace QuickMedia {
LocalMangaConfig local_manga;
LocalAnimeConfig local_anime;
YoutubeConfig youtube;
+ MatrixConfig matrix;
bool use_system_fonts = false;
bool use_system_mpv_config = false;
bool enable_shaders = true;
diff --git a/install.sh b/install.sh
index 9674474..92c4044 100755
--- a/install.sh
+++ b/install.sh
@@ -13,6 +13,9 @@ install -Dm755 "sibs-build/$(sibs platform)/release/quickmedia" "/usr/bin/quickm
ln -sf "/usr/bin/quickmedia" "/usr/bin/qm"
install -Dm644 boards.json "/usr/share/quickmedia/boards.json"
+install -Dm644 example-config.json "/usr/share/quickmedia/example-config.json"
+install -Dm644 README.md "/usr/share/quickmedia/README.md"
+
install -Dm644 mpv/fonts/Material-Design-Iconic-Font.ttf "/usr/share/quickmedia/mpv/fonts/Material-Design-Iconic-Font.ttf"
install -Dm644 mpv/scripts/mordenx.lua "/usr/share/quickmedia/mpv/scripts/mordenx.lua"
install -Dm644 mpv/input.conf "/usr/share/quickmedia/mpv/input.conf"
diff --git a/src/Config.cpp b/src/Config.cpp
index 50cab3c..c6c2a29 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -89,6 +89,29 @@ namespace QuickMedia {
val = json_val.asDouble();
}
+ static void matrix_known_homeservers_fallback() {
+ config->matrix.known_homeservers.insert(config->matrix.known_homeservers.end(), {
+ "midov.pl",
+ "matrix.org",
+ "kde.org",
+ "librem.one",
+ "maunium.net",
+ "halogen.city",
+ "gnome.org",
+ "shivering-isles.com",
+ "nerdsin.space",
+ "glowers.club",
+ "privacytools.io",
+ "linuxdelta.com",
+ "tchncs.de",
+ "jupiterbroadcasting.com"
+ });
+ }
+
+ static void config_load_fail_fallback() {
+ matrix_known_homeservers_fallback();
+ }
+
// No-op if this has already been called before
static void init_config() {
if(config_initialized)
@@ -103,12 +126,14 @@ namespace QuickMedia {
Path config_path = get_storage_dir().join("config.json");
if(get_file_type(config_path) != FileType::REGULAR) {
+ config_load_fail_fallback();
return;
}
Json::Value json_root;
if(!read_file_as_json(config_path, json_root) || !json_root.isObject()) {
fprintf(stderr, "Warning: failed to parse config file: %s\n", config_path.data.c_str());
+ config_load_fail_fallback();
return;
}
@@ -170,6 +195,25 @@ namespace QuickMedia {
if(youtube_json.isObject())
get_json_value(youtube_json, "load_progress", config->youtube.load_progress);
+ bool has_known_homeservers_config = false;
+ const Json::Value &matrix_json = json_root["matrix"];
+ if(matrix_json.isObject()) {
+ const Json::Value &known_homeservers_json = matrix_json["known_homeservers"];
+ if(known_homeservers_json.isArray()) {
+ has_known_homeservers_config = true;
+ for(const Json::Value &known_homeserver : known_homeservers_json) {
+ if(!known_homeserver.isString()) {
+ fprintf(stderr, "Warning: matrix.known_homeservers config contains non string value\n");
+ continue;
+ }
+ config->matrix.known_homeservers.push_back(known_homeserver.asString());
+ }
+ }
+ }
+
+ if(!has_known_homeservers_config)
+ matrix_known_homeservers_fallback();
+
get_json_value(json_root, "use_system_fonts", config->use_system_fonts);
get_json_value(json_root, "use_system_mpv_config", config->use_system_mpv_config);
get_json_value(json_root, "enable_shaders", config->enable_shaders);
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 2ac6f90..7cbe2c4 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1843,6 +1843,7 @@ namespace QuickMedia {
}
auto body = create_body();
+ body->title_mark_urls = true;
if(include_reverse_image_search && !body_item->url.empty() && !body_item->thumbnail_url.empty()) {
std::string image_url = body_item->url;
@@ -7536,21 +7537,12 @@ namespace QuickMedia {
auto matrix_invites_page = std::make_unique<MatrixInvitesPage>(this, matrix, invites_body.get());
BodyItems room_dir_body_items;
+
add_body_item_unique_title(room_dir_body_items, matrix->get_homeserver_domain());
- add_body_item_unique_title(room_dir_body_items, "midov.pl");
- add_body_item_unique_title(room_dir_body_items, "matrix.org");
- add_body_item_unique_title(room_dir_body_items, "kde.org");
- add_body_item_unique_title(room_dir_body_items, "librem.one");
- add_body_item_unique_title(room_dir_body_items, "maunium.net");
- add_body_item_unique_title(room_dir_body_items, "halogen.city");
- add_body_item_unique_title(room_dir_body_items, "gnome.org");
- add_body_item_unique_title(room_dir_body_items, "shivering-isles.com");
- add_body_item_unique_title(room_dir_body_items, "nerdsin.space");
- add_body_item_unique_title(room_dir_body_items, "glowers.club");
- add_body_item_unique_title(room_dir_body_items, "privacytools.io");
- add_body_item_unique_title(room_dir_body_items, "linuxdelta.com");
- add_body_item_unique_title(room_dir_body_items, "tchncs.de");
- add_body_item_unique_title(room_dir_body_items, "jupiterbroadcasting.com");
+ for(const std::string &known_homeserver : get_config().matrix.known_homeservers) {
+ add_body_item_unique_title(room_dir_body_items, known_homeserver);
+ }
+
auto room_directory_body = create_body();
room_directory_body->set_items(std::move(room_dir_body_items));
auto matrix_room_directory_page = std::make_unique<MatrixRoomDirectoryPage>(this, matrix);
diff --git a/src/plugins/Saucenao.cpp b/src/plugins/Saucenao.cpp
index ac2b622..1c841b1 100644
--- a/src/plugins/Saucenao.cpp
+++ b/src/plugins/Saucenao.cpp
@@ -60,6 +60,7 @@ namespace QuickMedia {
body_items.push_back(InfoPage::add_google_search(args.title));
auto body = create_body();
+ body->title_mark_urls = true;
body->set_items(std::move(body_items));
result_tabs.push_back(Tab{ std::move(body), std::make_unique<InfoPage>(program), create_search_bar("Search...", SEARCH_DELAY_FILTER) });
return PluginResult::OK;