Merge branch 'develop' into main
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
commit
2b8e443da7
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "remwharead",
|
||||
"version": "0.4.1",
|
||||
"version": "0.5.0",
|
||||
|
||||
"description": "Integrates remwharead into your Browser.",
|
||||
"homepage_url": "https://schlomp.space/tastytea/remwharead",
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// TODO: Rewrite this in understandable code.
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
|
@ -30,7 +32,7 @@ using std::system;
|
|||
string read_input();
|
||||
void send_message(const string &message);
|
||||
int launch(const string &args);
|
||||
string decode_args(const string &args);
|
||||
string decode_args(string args);
|
||||
void replace_in_field(string &field);
|
||||
|
||||
string read_input()
|
||||
|
@ -80,9 +82,17 @@ int launch(const string &args)
|
|||
return ret;
|
||||
}
|
||||
|
||||
string decode_args(const string &args)
|
||||
string decode_args(string args)
|
||||
{
|
||||
constexpr char separator{'\u001F'}; // UNIT SEPARATOR.
|
||||
{ // The string we get is escaped.
|
||||
size_t pos{0};
|
||||
while ((pos = args.find(R"(\u001f)", pos)) != string::npos)
|
||||
{
|
||||
args.replace(pos, 6, "\u001f");
|
||||
}
|
||||
}
|
||||
|
||||
constexpr char separator{'\u001f'}; // UNIT SEPARATOR.
|
||||
if (args[0] != separator) // Extension uses old method.
|
||||
{
|
||||
return args;
|
||||
|
@ -112,6 +122,7 @@ void replace_in_field(string &field)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
const string args = read_input();
|
||||
|
|
|
@ -7,12 +7,13 @@ const chkarchive = document.getElementById("chkarchive");
|
|||
const btnadd = document.getElementById("btnadd");
|
||||
const msgstatus = document.getElementById("msgstatus");
|
||||
const msgerror = document.getElementById("msgerror");
|
||||
const separator = '\u001f';
|
||||
|
||||
|
||||
function set_taburl(tabs) // Set taburl to URL of current tab.
|
||||
{
|
||||
const tab = tabs[0];
|
||||
taburl = '\'' + tab.url + '\'';
|
||||
taburl = separator + tab.url + separator;
|
||||
}
|
||||
|
||||
function get_tags() // get tags from text input.
|
||||
|
@ -20,7 +21,7 @@ function get_tags() // get tags from text input.
|
|||
const tags = txttags.value;
|
||||
if (tags != "")
|
||||
{
|
||||
return "-t '" + tags + "' ";
|
||||
return separator + "-t " + tags;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ function add()
|
|||
let archive = "";
|
||||
if (chkarchive.checked === false)
|
||||
{
|
||||
archive = "--no-archive ";
|
||||
archive = separator + "--no-archive";
|
||||
}
|
||||
const args = get_tags() + archive + taburl;
|
||||
console.log(args);
|
||||
|
|
Loading…
Reference in New Issue