Skip to content

Commit 7878a73

Browse files
⚡ feat(version): add version to popup
1 parent e4ac2f5 commit 7878a73

File tree

6 files changed

+50
-5
lines changed

6 files changed

+50
-5
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ Unstable internet connection is already a pain, when you have to access some rem
1111

1212
This extension will help you to update your IP address in the access list with just one click.
1313

14+
## Installation
15+
16+
[link-chrome]: https://chrome.google.com/webstore/detail/mongo-ip-updater/cklilnpehpogpeoeklbefjbjafcnlofj 'Version published on Chrome Web Store'
17+
18+
[<img src="https://raw.githubusercontent.com/alrra/browser-logos/90fdf03c/src/chrome/chrome.svg" width="48" alt="Chrome" valign="middle">][link-chrome] [<img valign="middle" src="https://img.shields.io/chrome-web-store/v/cklilnpehpogpeoeklbefjbjafcnlofj.svg?label=%20">][link-chrome] and other Chromium browsers
19+
20+
21+
### Development
22+
23+
- Get it locally -
24+
25+
```sh
26+
$ git clone https://github.com/aashutoshrathi/mongo-ip-updater.git
27+
```
28+
29+
**OR**
30+
31+
Download the latest version here: [Mongo IP Updater ✨](https://github.com/aashutoshrathi/mongo-ip-updater/archive/master.zip)
32+
33+
- Go to `chrome://extensions/` & enable Developer Mode.
34+
- Click on Load Unpacked Extension and Open/Select the folder.
35+
1436
## Demo 📺
1537

1638
![Mongo NAL Upsert Demo](https://s3.ap-south-1.amazonaws.com/shared.aashutosh.dev/ip-updater-0.1.0.gif)

src/background.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ const MANIFEST = chrome.runtime.getManifest();
22
const onInstalled = async () => {
33
const sites = MANIFEST.content_scripts.map((t) => t.matches).flat();
44
const tabs = await chrome.tabs.query({ url: sites });
5+
chrome.storage.sync.set({ version: `v${MANIFEST.version}` });
56
await Promise.all(Array.from(tabs, (tab) => chrome.tabs.reload(tab.id)));
6-
}
7+
};
78

89
// reload pages on install
910
chrome.runtime.onInstalled.addListener(onInstalled);

src/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const runIt = async (values) => {
8686
window.onload = () => {
8787
chrome.runtime.onMessage.addListener(
8888
async (request, sender, sendResponse) => {
89-
if (request.action === "upsert") {
89+
if (request.action === "UPSERT_IP_ENTRY") {
9090
await runIt(request.values);
9191
}
9292
return;

src/options/index.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ input {
3939
flex-direction: row;
4040
}
4141

42+
.space-between {
43+
justify-content: space-between;
44+
}
45+
4246

4347
.f-1 {
4448
flex: 1;
@@ -82,6 +86,10 @@ input {
8286
margin-bottom: 0;
8387
}
8488

89+
.ml-6 {
90+
margin-left: 6px;
91+
}
92+
8593
.lazy {
8694
font-size: 12px;
8795
align-self: flex-end;
@@ -110,6 +118,11 @@ input {
110118
background-color: #5464db;
111119
}
112120

121+
#version {
122+
font-size: 12px;
123+
maring-left: 30px !important;
124+
}
125+
113126
.submit {
114127
margin-top: 10px;
115128
letter-spacing: 1.2px;

src/options/index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
<div class="icon-container">
1111
<img class="icon" src="../../icons/icon.png" />
1212
</div>
13-
<div class="vflex f-1 text-center">
13+
<div class="vflex f-1 ml-6">
1414
<p class="heading">MONGO IP UPDATER</p>
15-
<i class="lazy">&nbsp;&nbsp;&nbsp;for the supa hackas</i>
15+
<div class="hflex space-between">
16+
<span id="version"></span>
17+
<i class="lazy">&nbsp;&nbsp;&nbsp;for the supa hackas</i>
18+
</div>
1619
</div>
1720
</div>
1821
<div>

src/options/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ document.addEventListener("DOMContentLoaded", function () {
2222
}
2323
});
2424

25+
chrome.storage.sync.get("version", function (data) {
26+
if (data.version) {
27+
document.querySelector('#version').innerHTML = data.version;
28+
}
29+
});
30+
2531
// Fill in the current IP
2632
updateIpField();
2733

@@ -46,7 +52,7 @@ document.addEventListener("DOMContentLoaded", function () {
4652
const name = document.querySelector('input[name="name"]').value;
4753
const ip = document.querySelector("input[name='ip']").value;
4854
await chrome.tabs.sendMessage(tab.id, {
49-
action: "upsert",
55+
action: "UPSERT_IP_ENTRY",
5056
values: {
5157
name,
5258
ip,

0 commit comments

Comments
 (0)