Skip to content

Commit

Permalink
move to manifest 3
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-hanheide committed Nov 7, 2023
1 parent 5b2a9a4 commit a1c19bf
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 23 deletions.
53 changes: 30 additions & 23 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
{
"page_action": {
"default_icon": "icons/128.png",
"default_popup": "scripts/popup.html",
"default_title": "show the Openconnect cookie/cmd line"
},
"description": "easily extract and display the VPN cookie to use with openconnect and Cisco AnyConnect Servers.",
"icons": {
"128": "icons/128.png",
"26": "icons/26.png",
"32": "icons/32.png",
"48": "icons/48.png"
},
"manifest_version": 2,
"name": "OpenAnyconnect Cookie Tray (Uni Lincoln)",
"offline_enabled": false,
"permissions": ["declarativeContent", "activeTab", "cookies", "https://remote.lincoln.ac.uk/*" ],
"short_name": "cookietray",
"version": "0.0.2",
"background": {
"scripts": ["scripts/background.js"],
"persistent": false
}
}
"description": "easily extract and display the VPN cookie to use with openconnect and Cisco AnyConnect Servers.",
"icons": {
"128": "icons/128.png",
"26": "icons/26.png",
"32": "icons/32.png",
"48": "icons/48.png"
},
"manifest_version": 3,
"name": "OpenAnyconnect Cookie Tray (Uni Lincoln)",
"offline_enabled": false,
"permissions": [
"declarativeContent",
"activeTab",
"cookies"
],
"short_name": "cookietray",
"version": "0.1.0",
"background": {
"service_worker": "service_worker.js"
},
"action": {
"default_icon": "icons/128.png",
"default_popup": "scripts/popup.html",
"default_title": "show the Openconnect cookie/cmd line"
},
"content_security_policy": {},
"host_permissions": [
"https://remote.lincoln.ac.uk/*"
]
}
18 changes: 18 additions & 0 deletions service_worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
chrome.runtime.onInstalled.addListener(function() {
// Replace all rules ...
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
// With a new rule ...
chrome.declarativeContent.onPageChanged.addRules([
{
// That fires when a page's URL contains a 'g' ...
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { urlContains: 'https://remote.lincoln.ac.uk' },
})
],
// And shows the extension's page action.
actions: [ new chrome.declarativeContent.ShowPageAction() ]
}
]);
});
});

0 comments on commit a1c19bf

Please sign in to comment.