aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-20 03:58:50 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-20 03:58:50 +0200
commit45c427b23e035aac49bc961115a1beff1f74d5ee (patch)
treee9f255fb0a57c5d510f3852f1540ec697d2f8026 /src
parent834347390d90e8d38691674211f2eab63a9b7729 (diff)
Use url/filename safe base64
Diffstat (limited to 'src')
-rw-r--r--src/DownloadUtils.cpp4
-rw-r--r--src/QuickMedia.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp
index cb87890..deb5c29 100644
--- a/src/DownloadUtils.cpp
+++ b/src/DownloadUtils.cpp
@@ -1,8 +1,8 @@
#include "../include/DownloadUtils.hpp"
#include "../include/Program.h"
#include "../include/Storage.hpp"
+#include "../include/base64_url.hpp"
#include <SFML/System/Clock.hpp>
-#include <cppcodec/base64_rfc4648.hpp>
static const bool debug_download = false;
@@ -48,7 +48,7 @@ namespace QuickMedia {
DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent) {
Path media_dir = get_cache_dir().join("media");
- Path media_file_path = Path(media_dir).join(cppcodec::base64_rfc4648::encode(url));
+ Path media_file_path = Path(media_dir).join(base64_url::encode(url));
Path media_file_path_tmp(media_file_path.data + ".tmp");
if(get_file_type(media_file_path) == FileType::REGULAR) {
if(file_get_content(media_file_path, result) == 0) {
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 71ba2a5..956370f 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -15,7 +15,7 @@
#include "../include/Notification.hpp"
#include "../include/ImageViewer.hpp"
#include "../include/ImageUtils.hpp"
-#include <cppcodec/base64_rfc4648.hpp>
+#include "../include/base64_url.hpp"
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/Sprite.hpp>
@@ -498,11 +498,11 @@ namespace QuickMedia {
}
static std::string base64_encode(const std::string &data) {
- return cppcodec::base64_rfc4648::encode(data);
+ return base64_url::encode(data);
}
static std::string base64_decode(const std::string &data) {
- return cppcodec::base64_rfc4648::decode<std::string>(data);
+ return base64_url::decode<std::string>(data);
}
static bool read_file_as_json(const Path &filepath, Json::Value &result) {