Skip to content

Commit

Permalink
Simplify CryptPad URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
wginolas committed Nov 16, 2023
1 parent 3d02201 commit 4924c86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions www/diagram/inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ define([
const url = new URL(src);
const params = new URLSearchParams();
params.set('type', type);
params.set('protocol', url.protocol);
url.search = params.toString();
url.protocol = url.protocol === 'https:' ? 'cryptpads:' : 'cryptpad:';
url.protocol = 'cryptpad:';
url.hash = key;
return url.href;
};

const parseCryptPadUrl = function(href) {
const url = new URL(href);
url.protocol = url.protocol === 'cryptpads:' ? 'https:' : 'http:';
url.protocol = url.searchParams.get('protocol');
const key = url.hash.substring(1); // remove leading '#'
const type = url.searchParams.get('type');
url.search = '';
Expand Down

0 comments on commit 4924c86

Please sign in to comment.