Skip to content

Commit

Permalink
Apply several fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ANSH3LL authored Apr 20, 2021
1 parent c70c5a4 commit e3df0af
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Picture",
"version": "0.1",
"version": "0.12",
"manifest_version": 2,
"description": "Redirects all instagram URLs to smihub.com or picuki.com per user choice",

Expand Down
14 changes: 10 additions & 4 deletions picture.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ function getUsername(igurl) {
function getMediaId(igurl) {
mediaId = BigInt(0);
url = decodeURIComponent(igurl);
shortcode = url.match(instaPost)[2].split('');
shortcode = url.match(postRegex)[2].split('');
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
shortcode.forEach((letter) => {
mediaId = BigInt((mediaId * 64n)) + BigInt(alphabet.indexOf(letter));
});
return mediaId.toString().split('').reverse().join('');
if(document.igRequestHandler == 1) {
return mediaId.toString().split('').reverse().join('');
} else if(document.igRequestHandler == 2) {
return mediaId.toString().split('').join('');
} else {
return '';
}
}

function setPrefix(result) {
Expand Down Expand Up @@ -66,5 +72,5 @@ function igRedirect(details) {
return {redirectUrl: url};
}

browser.storage.onChanged.addListener(loadPreferences);
browser.webRequest.onBeforeRequest.addListener(igRedirect, filter, ['blocking']);
loadPreferences('dummy', 'dummy');
browser.storage.onChanged.addListener(loadPreferences);
2 changes: 1 addition & 1 deletion popup/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
</head>
<body>
<p id="status">Status: Using smihub.com</p>
<p id="status"></p>
<button id="smihub">Use smihub.com</button>
<button id="picuki">Use picuki.com</button>
<button id="disabled">Disable Picture</button>
Expand Down

0 comments on commit e3df0af

Please sign in to comment.