mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-16 06:05:37 +07:00
New Feature - Report URLs
Lately, I have received relatively few requests with potentially bad URLs. On the one hand, that could be because ClearURLs are working very well by now. But I also think that not everyone wants to sign up to GitLab to report a URL. That's why I've added a new button that reports the current URL in the active tab to me, so I can take a closer look at the URL. So that you can see exactly what data will be sent to me, I have uploaded the source code for the PHP script, of course, without a password etc. Please be careful not to send URLs with personal information or tokens.
This commit is contained in:
@@ -11,6 +11,8 @@ var badgedStatus;
|
||||
var hashStatus;
|
||||
var loggingStatus;
|
||||
var statisticsStatus;
|
||||
var currentURL;
|
||||
var reportServer;
|
||||
|
||||
var core = function (func) {
|
||||
return browser.runtime.getBackgroundPage().then(func);
|
||||
@@ -26,6 +28,8 @@ function getData()
|
||||
hashStatus = ref.getData('hashStatus');
|
||||
loggingStatus = ref.getData('loggingStatus');
|
||||
statisticsStatus = ref.getData('statisticsStatus');
|
||||
currentURL = ref.getCurrentURL();
|
||||
reportServer = ref.getData('reportServer');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -174,6 +178,7 @@ $(document).ready(function(){
|
||||
changeSwitchButton("statistics", "statisticsStatus");
|
||||
$('#loggingPage').attr('href', browser.extension.getURL('./html/log.html'));
|
||||
$('#settings').attr('href', browser.extension.getURL('./html/settings.html'));
|
||||
$('#reportButton').on("click", reportURL);
|
||||
setText();
|
||||
} else {
|
||||
$('#config_section').remove();
|
||||
@@ -202,6 +207,7 @@ function setText()
|
||||
injectText('configs_switch_filter','popup_html_configs_switch_filter');
|
||||
injectText('configs_head','popup_html_configs_head');
|
||||
injectText('configs_switch_statistics','configs_switch_statistics');
|
||||
injectText('reportButton', 'popup_html_report_button', true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,3 +243,19 @@ function translate(string)
|
||||
{
|
||||
return browser.i18n.getMessage(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the url to the DB on clearurls.röb.it to checked for tracking fields.
|
||||
*/
|
||||
function reportURL()
|
||||
{
|
||||
$.ajax({
|
||||
url: reportServer+'/report_url.php?url='+encodeURI(currentURL),
|
||||
success: function(result) {
|
||||
window.alert(translate('success_report_url'));
|
||||
},
|
||||
error: function(result) {
|
||||
window.alert(translate('error_report_url'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ function save()
|
||||
ref.setData('ruleURL', $('input[name=rule_url]').val());
|
||||
ref.setData('hashURL', $('input[name=hash_url]').val());
|
||||
ref.setData('types', $('input[name=types]').val());
|
||||
ref.setData('reportServer', $('input[name=report_server]').val());
|
||||
ref.saveOnExit();
|
||||
ref.reload();
|
||||
});
|
||||
@@ -76,6 +77,7 @@ function getData()
|
||||
settings.rule_url = ref.getData('ruleURL');
|
||||
settings.hash_url = ref.getData('hashURL');
|
||||
settings.types = ref.getData('types');
|
||||
settings.reportServer = ref.getData('reportServer');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,4 +100,6 @@ function setText()
|
||||
$('input[name=types]').val(settings.types);
|
||||
$('#save_settings_btn').text(translate('settings_html_save_button'));
|
||||
$('#save_settings_btn').prop('title', translate('settings_html_save_button_title'));
|
||||
$('#report_server_label').html(translate('setting_report_server_label'));
|
||||
$('input[name=report_server]').val(settings.reportServer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user