Skip to content

Commit

Permalink
applied necessary changes to stay compatible with 2a5.de
Browse files Browse the repository at this point in the history
  • Loading branch information
reckseba committed Apr 4, 2023
1 parent df60c24 commit 537d559
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 7 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# 2a5-addon
2a5 Browser Bar Extension

## Development

- Open Firefox
- Goto: about:debugging#/runtime/this-firefox
- Load Temporary Add-on...
- Select manifest.json
- Click Inspect button and open tab network to see XHR requests in action

## Prepare Publishing
```bash
sudo npm install --global web-ext
cd app
```

This is how web-ext works: https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/


## Publish: go the manual upload way
```bash
web-ext build
```
Upload the packed zip file from web-ext-artifacts:
- Login to mozilla and goto https://addons.mozilla.org/de/developers/addon/2a5-de-url-shortener-addon/versions/submit/

Wait until it gets accepted.

Then goto https://addons.mozilla.org/de/developers/addon/2a5-de-url-shortener-addon/versions/5549013 and download the XPI file

Put the XPI file to `releases` folder and calculate checksum `sha256sum 2a5_de_url_shortener_addon-1.2.0.xpi`.


## Publish: go the cli way

Go and get a key here https://addons.mozilla.org/de/developers/addon/api/key/

Grab the UUID from addons page https://addons.mozilla.org/de/developers/addon/2a5-de-url-shortener-addon/edit

Then run:
```bash
web-ext sign --channel=listed --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET --id="{UUID}"
```

Yeah... this is not working...

4 changes: 2 additions & 2 deletions app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"activeTab",
"clipboardWrite"
],
"version": "1.0.0"
}
"version": "1.2.0"
}
4 changes: 2 additions & 2 deletions app/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function call2a5(tabs) {
});

// our endpoint and we want to post
xhr.open('POST', 'https://2a5.de/newUrlLong');
xhr.open('PUT', 'https://2a5.de/api/newUrlLong');

// we'll post an json object as this is required by our endpoint
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
Expand All @@ -30,7 +30,7 @@ function call2a5(tabs) {
xhr.onload = function() {

// check for http status code - if not 200 success then log sth
if (xhr.status != 200) {
if (![201, 409].includes(xhr.status)) {
console.log(`Error ${xhr.status}: ${xhr.statusText}`);
} else {

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fcd40a662708b4b115d3690de92a7e9405430e4ba602ee9a84f6d691f3d9bff0 2a5de_url_shortener_addon-1.0.0-fx.xpi
fcd40a662708b4b115d3690de92a7e9405430e4ba602ee9a84f6d691f3d9bff0 2a5de_url_shortener_addon-1.0.0.xpi
10 changes: 10 additions & 0 deletions releases/2a5_de_url_shortener_addon-1.2.0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h1>2a5.de URL Shortener Addon 1.2.0</h1>
<div>2a5.de was updated recently and therefore api routes needed an update.</div>
</body>
</html>
1 change: 1 addition & 0 deletions releases/2a5_de_url_shortener_addon-1.2.0.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5f41fd964b62c28591a5a8d0c59007108eeaccecd2f94a38edb88dd33d26d49f 2a5de_url_shortener_addon-1.2.0.xpi
Binary file added releases/2a5_de_url_shortener_addon-1.2.0.xpi
Binary file not shown.
10 changes: 8 additions & 2 deletions releases/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
"updates": [
{
"version": "1.0.0",
"update_link": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5de_url_shortener_addon-1.0.0-fx.xpi",
"update_info_url": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5de_url_shortener_addon-1.0.0-fx.html",
"update_link": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.0.0.xpi",
"update_info_url": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.0.0.html",
"update_hash": "sha256:fcd40a662708b4b115d3690de92a7e9405430e4ba602ee9a84f6d691f3d9bff0"
},
{
"version": "1.2.0",
"update_link": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.2.0.xpi",
"update_info_url": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.2.0.html",
"update_hash": "sha256:5f41fd964b62c28591a5a8d0c59007108eeaccecd2f94a38edb88dd33d26d49f"
}
]
}
Expand Down

0 comments on commit 537d559

Please sign in to comment.