diff options
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | plugins/Matrix.hpp | 2 | ||||
-rw-r--r-- | src/FileAnalyzer.cpp | 6 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 10 | ||||
-rw-r--r-- | src/plugins/FileManager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 12 |
6 files changed, 17 insertions, 18 deletions
@@ -234,4 +234,5 @@ Consider adding an option to use external sxiv, imv etc instead of mpv/quickmedi 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. Add option to use invidious, and the invidious front page. -Add proper vim modal mode. Maybe switch focused part with tab? then also need to show which part is focused.
\ No newline at end of file +Add proper vim modal mode. Maybe switch focused part with tab? then also need to show which part is focused. +Send clipboard content to clipboard manager when destroying the window, if we are the clipboard owner
\ No newline at end of file diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index 45dd1f7..36188f0 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -629,7 +629,7 @@ namespace QuickMedia { void remove_rooms(const rapidjson::Value &leave_json); PluginResult get_pinned_events(RoomData *room, std::vector<std::string> &pinned_events); std::shared_ptr<Message> parse_message_event(const rapidjson::Value &event_item_json, RoomData *room_data); - PluginResult upload_file(RoomData *room, const std::string &filepath, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg, bool upload_thumbnail = true); + PluginResult upload_file(RoomData *room, const std::string &filepath, std::string filename, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg, bool upload_thumbnail = true); void add_room(std::unique_ptr<RoomData> room); void remove_room(const std::string &room_id); // Returns false if an invite to the room already exists diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp index f16c232..aeb88f7 100644 --- a/src/FileAnalyzer.cpp +++ b/src/FileAnalyzer.cpp @@ -82,9 +82,9 @@ namespace QuickMedia { case ContentType::AUDIO_MPEG: return "audio/mpeg"; case ContentType::AUDIO_MIDI: return "audio/midi"; case ContentType::AUDIO_WAVE: return "audio/wave"; - case ContentType::AUDIO_FLAC: return "audio/wave"; + case ContentType::AUDIO_FLAC: return "audio/flac"; case ContentType::AUDIO_VORBIS: return "audio/ogg"; - case ContentType::AUDIO_OPUS: return "audio/ogg"; + case ContentType::AUDIO_OPUS: return "audio/opus"; case ContentType::IMAGE_JPEG: return "image/jpeg"; case ContentType::IMAGE_PNG: return "image/png"; case ContentType::IMAGE_GIF: return "image/gif"; @@ -129,7 +129,7 @@ namespace QuickMedia { bool video_get_first_frame(const FileAnalyzer &file, const char *destination_path, int width, int height) { Path destination_path_tmp = destination_path; - destination_path_tmp.append(".tmp.jpg"); + destination_path_tmp.append(".tmp.jpg"); // TODO: .png, but the below code also needs to be changed for that const int middle_seconds = file.get_duration_seconds().value_or(0.0) / 2.0; char middle_seconds_str[32]; diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index fa8dd66..3e77797 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -378,9 +378,6 @@ namespace QuickMedia { return -1; } - if(argc == 1) - plugin_name = "launcher"; - Window parent_window = None; video_max_height = 0; std::vector<Tab> tabs; @@ -489,11 +486,8 @@ namespace QuickMedia { } } - if(!plugin_name) { - fprintf(stderr, "Missing plugin argument\n"); - usage(); - return -1; - } + if(!plugin_name) + plugin_name = "launcher"; if(low_cpu_mode) FPS_IDLE = 3; diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp index 5fd6670..45c61bf 100644 --- a/src/plugins/FileManager.cpp +++ b/src/plugins/FileManager.cpp @@ -21,6 +21,8 @@ namespace QuickMedia { const char *path_c = path.c_str(); int len = strlen(path_c); for(int i = len - 1; i >= 0; --i) { + if(path_c[i] == '/') + return ""; if(path_c[i] == '.') return path_c + i; } diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 00009fd..14f49bf 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -3674,7 +3674,7 @@ namespace QuickMedia { PluginResult Matrix::post_file(RoomData *room, const std::string &filepath, std::string filename, std::string &event_id_response, std::string &err_msg) { UploadInfo file_info; UploadInfo thumbnail_info; - PluginResult upload_file_result = upload_file(room, filepath, file_info, thumbnail_info, err_msg); + PluginResult upload_file_result = upload_file(room, filepath, filename, file_info, thumbnail_info, err_msg); if(upload_file_result != PluginResult::OK) return upload_file_result; @@ -3689,7 +3689,7 @@ namespace QuickMedia { return post_message(room, filename, event_id_response, file_info_opt, thumbnail_info_opt); } - PluginResult Matrix::upload_file(RoomData *room, const std::string &filepath, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg, bool upload_thumbnail) { + PluginResult Matrix::upload_file(RoomData *room, const std::string &filepath, std::string filename, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg, bool upload_thumbnail) { FileAnalyzer file_analyzer; if(!file_analyzer.load_file(filepath.c_str(), true)) { err_msg = "Failed to load " + filepath; @@ -3725,7 +3725,7 @@ namespace QuickMedia { if(tmp_file != -1) { if(video_get_first_frame(file_analyzer, tmp_filename, thumbnail_max_size.x, thumbnail_max_size.y)) { UploadInfo upload_info_ignored; // Ignore because it wont be set anyways. Thumbnails dont have thumbnails. - PluginResult upload_thumbnail_result = upload_file(room, tmp_filename, thumbnail_info, upload_info_ignored, err_msg, false); + PluginResult upload_thumbnail_result = upload_file(room, tmp_filename, "", thumbnail_info, upload_info_ignored, err_msg, false); if(upload_thumbnail_result != PluginResult::OK) { close(tmp_file); remove(tmp_filename); @@ -3750,7 +3750,7 @@ namespace QuickMedia { thumbnail_path = filepath; UploadInfo upload_info_ignored; // Ignore because it wont be set anyways. Thumbnails dont have thumbnails. - PluginResult upload_thumbnail_result = upload_file(room, thumbnail_path, thumbnail_info, upload_info_ignored, err_msg, false); + PluginResult upload_thumbnail_result = upload_file(room, thumbnail_path, "", thumbnail_info, upload_info_ignored, err_msg, false); if(upload_thumbnail_result != PluginResult::OK) { close(tmp_file); remove(tmp_filename); @@ -3771,7 +3771,9 @@ namespace QuickMedia { { "--data-binary", "@" + filepath } }; - const char *filename = file_get_filename(filepath); + if(filename.empty()) + filename = file_get_filename(filepath); + std::string filename_escaped = url_param_encode(filename); char url[512]; |