mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
1. adapt mv3 alarm trigger flow. 2. adapt mv3 background event page lifecycle.
This commit is contained in:
parent
45295e149c
commit
815e162640
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "ZeroOmega--Proxy Switchy manifest v3 version",
|
"name": "ZeroOmega--Proxy Switchy manifest v3 version",
|
||||||
"version": "3.2.0",
|
"version": "3.2.1",
|
||||||
"description": "__MSG_manifest_app_description__",
|
"description": "__MSG_manifest_app_description__",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "img/icons/omega-action-16.png",
|
"16": "img/icons/omega-action-16.png",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "ZeroOmega--Proxy Switchy manifest v3 version",
|
"name": "ZeroOmega--Proxy Switchy manifest v3 version",
|
||||||
"version": "3.2.0",
|
"version": "3.2.1",
|
||||||
"description": "__MSG_manifest_app_description__",
|
"description": "__MSG_manifest_app_description__",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "img/icons/omega-action-16.png",
|
"16": "img/icons/omega-action-16.png",
|
||||||
|
@ -9,7 +9,10 @@ Url = require('url')
|
|||||||
|
|
||||||
TEMPPROFILEKEY = 'tempProfileState'
|
TEMPPROFILEKEY = 'tempProfileState'
|
||||||
|
|
||||||
|
globalThis.isBrowserRestart = false
|
||||||
|
|
||||||
chrome.runtime.onStartup.addListener ->
|
chrome.runtime.onStartup.addListener ->
|
||||||
|
globalThis.isBrowserRestart = true
|
||||||
console.log('delete temp profile')
|
console.log('delete temp profile')
|
||||||
idbKeyval.del(TEMPPROFILEKEY).then(->
|
idbKeyval.del(TEMPPROFILEKEY).then(->
|
||||||
console.log('delete temp profile success')
|
console.log('delete temp profile success')
|
||||||
@ -22,6 +25,13 @@ class ChromeOptions extends OmegaTarget.Options
|
|||||||
|
|
||||||
constructor: (args...) ->
|
constructor: (args...) ->
|
||||||
super(args...)
|
super(args...)
|
||||||
|
chrome.alarms.onAlarm.addListener (alarm) =>
|
||||||
|
switch alarm.name
|
||||||
|
when 'omega.updateProfile'
|
||||||
|
console.log('update profile interval')
|
||||||
|
@ready.then( =>
|
||||||
|
@updateProfile()
|
||||||
|
)
|
||||||
chrome.contextMenus.onClicked.addListener((info, tab) =>
|
chrome.contextMenus.onClicked.addListener((info, tab) =>
|
||||||
@ready.then( =>
|
@ready.then( =>
|
||||||
switch info.menuItemId
|
switch info.menuItemId
|
||||||
@ -224,18 +234,11 @@ class ChromeOptions extends OmegaTarget.Options
|
|||||||
port.onDisconnect.addListener =>
|
port.onDisconnect.addListener =>
|
||||||
delete @_tabRequestInfoPorts[tabId] if tabId?
|
delete @_tabRequestInfoPorts[tabId] if tabId?
|
||||||
|
|
||||||
_alarms: null
|
schedule: (name, periodInMinutes) ->
|
||||||
schedule: (name, periodInMinutes, callback) ->
|
|
||||||
name = 'omega.' + name
|
name = 'omega.' + name
|
||||||
if not _alarms?
|
|
||||||
@_alarms = {}
|
|
||||||
chrome.alarms.onAlarm.addListener (alarm) =>
|
|
||||||
@_alarms[alarm.name]?()
|
|
||||||
if periodInMinutes < 0
|
if periodInMinutes < 0
|
||||||
delete @_alarms[name]
|
|
||||||
chrome.alarms.clear(name)
|
chrome.alarms.clear(name)
|
||||||
else
|
else
|
||||||
@_alarms[name] = callback
|
|
||||||
chrome.alarms.create(name, {
|
chrome.alarms.create(name, {
|
||||||
periodInMinutes: periodInMinutes
|
periodInMinutes: periodInMinutes
|
||||||
})
|
})
|
||||||
|
@ -160,7 +160,7 @@ class Options
|
|||||||
###
|
###
|
||||||
init: ->
|
init: ->
|
||||||
@ready = @loadOptions().then(=>
|
@ready = @loadOptions().then(=>
|
||||||
if @_options['-startupProfileName']
|
if globalThis.isBrowserRestart and @_options['-startupProfileName']
|
||||||
@applyProfile(@_options['-startupProfileName'])
|
@applyProfile(@_options['-startupProfileName'])
|
||||||
else
|
else
|
||||||
@_state.get({
|
@_state.get({
|
||||||
@ -384,8 +384,7 @@ class Options
|
|||||||
if changes['-enableQuickSwitch']? or quickSwitchProfiles?
|
if changes['-enableQuickSwitch']? or quickSwitchProfiles?
|
||||||
@reloadQuickSwitch()
|
@reloadQuickSwitch()
|
||||||
if changes['-downloadInterval']?
|
if changes['-downloadInterval']?
|
||||||
@schedule 'updateProfile', @_options['-downloadInterval'], =>
|
@schedule 'updateProfile', @_options['-downloadInterval']
|
||||||
@updateProfile()
|
|
||||||
if changes['-showInspectMenu']? or changes == @_options
|
if changes['-showInspectMenu']? or changes == @_options
|
||||||
showMenu = @_options['-showInspectMenu']
|
showMenu = @_options['-showInspectMenu']
|
||||||
if not showMenu?
|
if not showMenu?
|
||||||
|
@ -17,6 +17,7 @@ html, body {
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
min-width: 12em;
|
min-width: 12em;
|
||||||
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.om-hidden {
|
.om-hidden {
|
||||||
|
Loading…
Reference in New Issue
Block a user