Skip to content

Controls for pseudonymisation #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ zeeschuimer.register_module(
let domain = source_platform_url.split("/")[2].toLowerCase().replace(/^www\./, '');

if (!["instagram.com"].includes(domain)) {
console.log('ignoring non-instagram url ' + source_url);
return [];
}

Expand Down
20 changes: 18 additions & 2 deletions popup/interface.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
margin-right: 0.25em;
}

input:not([type=checkbox]):not([type=radio]), button {
input:not([type=checkbox]):not([type=radio]), button, select {
background: var(--neutral-contrast-alt);
color: var(--accent);
border: 2px solid var(--neutral-contrast);
Expand Down Expand Up @@ -265,11 +265,15 @@
content: ' \2022';
}

.fourcat-url-container, .zeeschuimer-master-switch, .import-container {
.fourcat-url-container, .zeeschuimer-master-switch, .import-container, .fourcat-pseudonymisation-container {
text-align: center;
margin-bottom: 0.5em;
}

.fourcat-pseudonymisation-container select {
max-width: 15em;
}

#upload-status {
text-align: center;
}
Expand Down Expand Up @@ -411,6 +415,18 @@ <h2><span>Connect to 4CAT</span></h2>
title="The URL of the 4CAT server to upload datasets to. Make sure you're logged in to this URL with this browser.">?</span>
</label>
</div>
<div class="fourcat-pseudonymisation-container">
<label>
<span>Pseudonymise data in 4CAT:</span>
<select id="fourcat-pseudonymisation">
<option value="anonymise">Anonymise - Replace author information with 'REDACTED'</option>
<option value="pseudonymise">Pseudonymise - Replace author information with hashed values</option>
<option value="none">Leave author information as-is</option>
</select>
<span class="tooltippable"
title="4CAT can pseudonymise the data after importing it in a number of ways. Note that this happens AFTER uploading and non-pseudonymised data will always be sent to the 4CAT server first. 4CAT versions prior to 1.43 do not support this and will require you to manually pseudonymise after uploading.">?</span>
</label>
</div>
<p id="upload-status"></p>
</section>
<section>
Expand Down
12 changes: 10 additions & 2 deletions popup/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function get_4cat_url(e) {
* @returns {Promise<void>}
*/
async function set_4cat_url(e) {
if(e !== true && !e.target.matches('#fourcat-url')) {
if(e !== true && !e.target.matches('#fourcat-url') && !e.target.matches('#fourcat-pseudonymisation')) {
return;
}

Expand All @@ -105,6 +105,8 @@ async function set_4cat_url(e) {
}
}

await background.browser.storage.local.set({'4cat-pseudonymise': document.querySelector('#fourcat-pseudonymisation').value});

have_4cat = (url && url.length > 0);
}

Expand Down Expand Up @@ -314,8 +316,10 @@ async function button_handler(event) {
xhr = new XMLHttpRequest();
xhr.aborted = false;
let upload_url = await get_4cat_url();
let pseudonymise_bit = document.querySelector('#fourcat-pseudonymisation').value
pseudonymise_bit = pseudonymise_bit !== 'none' ? '?pseudonymise=' + pseudonymise_bit : ''

xhr.open("POST", upload_url + "/api/import-dataset/", true);
xhr.open("POST", upload_url + "/api/import-dataset/" + pseudonymise_bit, true);
xhr.setRequestHeader("X-Zeeschuimer-Platform", platform)
xhr.onloadstart = function () {
status.innerText = 'Starting upload...';
Expand Down Expand Up @@ -673,5 +677,9 @@ document.addEventListener('DOMContentLoaded', async function () {
const fourcat_url = await background.browser.storage.local.get('4cat-url');
document.querySelector('#fourcat-url').value = fourcat_url['4cat-url'] ? fourcat_url['4cat-url'] : '';

const pseudonymise = await background.browser.storage.local.get('4cat-pseudonymise');
console.log(pseudonymise);
document.querySelector('#fourcat-pseudonymisation').value = pseudonymise['4cat-pseudonymise'] ? pseudonymise['4cat-pseudonymise'] : 'none';

browser.downloads.onChanged.addListener(downloadListener);
});