Skip to content

Commit 537d559

Browse files
committed
applied necessary changes to stay compatible with 2a5.de
1 parent df60c24 commit 537d559

10 files changed

+69
-7
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
11
# 2a5-addon
22
2a5 Browser Bar Extension
3+
4+
## Development
5+
6+
- Open Firefox
7+
- Goto: about:debugging#/runtime/this-firefox
8+
- Load Temporary Add-on...
9+
- Select manifest.json
10+
- Click Inspect button and open tab network to see XHR requests in action
11+
12+
## Prepare Publishing
13+
```bash
14+
sudo npm install --global web-ext
15+
cd app
16+
```
17+
18+
This is how web-ext works: https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/
19+
20+
21+
## Publish: go the manual upload way
22+
```bash
23+
web-ext build
24+
```
25+
Upload the packed zip file from web-ext-artifacts:
26+
- Login to mozilla and goto https://addons.mozilla.org/de/developers/addon/2a5-de-url-shortener-addon/versions/submit/
27+
28+
Wait until it gets accepted.
29+
30+
Then goto https://addons.mozilla.org/de/developers/addon/2a5-de-url-shortener-addon/versions/5549013 and download the XPI file
31+
32+
Put the XPI file to `releases` folder and calculate checksum `sha256sum 2a5_de_url_shortener_addon-1.2.0.xpi`.
33+
34+
35+
## Publish: go the cli way
36+
37+
Go and get a key here https://addons.mozilla.org/de/developers/addon/api/key/
38+
39+
Grab the UUID from addons page https://addons.mozilla.org/de/developers/addon/2a5-de-url-shortener-addon/edit
40+
41+
Then run:
42+
```bash
43+
web-ext sign --channel=listed --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET --id="{UUID}"
44+
```
45+
46+
Yeah... this is not working...
47+

app/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
"activeTab",
2828
"clipboardWrite"
2929
],
30-
"version": "1.0.0"
31-
}
30+
"version": "1.2.0"
31+
}

app/popup/popup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function call2a5(tabs) {
1919
});
2020

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

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

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

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fcd40a662708b4b115d3690de92a7e9405430e4ba602ee9a84f6d691f3d9bff0 2a5de_url_shortener_addon-1.0.0-fx.xpi
1+
fcd40a662708b4b115d3690de92a7e9405430e4ba602ee9a84f6d691f3d9bff0 2a5de_url_shortener_addon-1.0.0.xpi
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
</head>
6+
<body>
7+
<h1>2a5.de URL Shortener Addon 1.2.0</h1>
8+
<div>2a5.de was updated recently and therefore api routes needed an update.</div>
9+
</body>
10+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5f41fd964b62c28591a5a8d0c59007108eeaccecd2f94a38edb88dd33d26d49f 2a5de_url_shortener_addon-1.2.0.xpi
14.1 KB
Binary file not shown.

releases/update.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
"updates": [
55
{
66
"version": "1.0.0",
7-
"update_link": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5de_url_shortener_addon-1.0.0-fx.xpi",
8-
"update_info_url": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5de_url_shortener_addon-1.0.0-fx.html",
7+
"update_link": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.0.0.xpi",
8+
"update_info_url": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.0.0.html",
99
"update_hash": "sha256:fcd40a662708b4b115d3690de92a7e9405430e4ba602ee9a84f6d691f3d9bff0"
10+
},
11+
{
12+
"version": "1.2.0",
13+
"update_link": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.2.0.xpi",
14+
"update_info_url": "https://raw.githubusercontent.com/reckseba/2a5-addon/main/releases/2a5_de_url_shortener_addon-1.2.0.html",
15+
"update_hash": "sha256:5f41fd964b62c28591a5a8d0c59007108eeaccecd2f94a38edb88dd33d26d49f"
1016
}
1117
]
1218
}

0 commit comments

Comments
 (0)