Skip to content

Commit

Permalink
fix: prettier fixes
Browse files Browse the repository at this point in the history
Signed-off-by: svrnm <neumanns@cisco.com>
  • Loading branch information
svrnm committed Nov 17, 2022
1 parent 0941557 commit 10a3ac2
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 60 deletions.
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@

## [8.2.5](https://github.com/svrnm/DemoMonkey/compare/v8.2.4...v8.2.5) (2022-09-28)


### version

* release 8.2.5 ([d42e674](https://github.com/svrnm/DemoMonkey/commit/d42e6744c3e763153be97860f9584c825ea11eee))
- release 8.2.5 ([d42e674](https://github.com/svrnm/DemoMonkey/commit/d42e6744c3e763153be97860f9584c825ea11eee))

## [8.2.4](https://github.com/svrnm/DemoMonkey/compare/v8.2.3...v8.2.4) (2022-09-28)


### version

* release 8.2.4 ([a240974](https://github.com/svrnm/DemoMonkey/commit/a2409740ac9c2d917cb1161d5221d59f955960e4))
- release 8.2.4 ([a240974](https://github.com/svrnm/DemoMonkey/commit/a2409740ac9c2d917cb1161d5221d59f955960e4))

## [8.2.3](https://github.com/svrnm/DemoMonkey/compare/v8.2.2...v8.2.3) (2022-09-28)


### version

* release 8.2.3 ([6557edb](https://github.com/svrnm/DemoMonkey/commit/6557edbd6eca9d2e6eec862c8e435c31ca070955))
- release 8.2.3 ([6557edb](https://github.com/svrnm/DemoMonkey/commit/6557edbd6eca9d2e6eec862c8e435c31ca070955))

## [8.2.2](https://github.com/svrnm/DemoMonkey/compare/v8.2.1...v8.2.2) (2022-09-28)

Expand Down
99 changes: 51 additions & 48 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,65 +106,68 @@ fetch(window.chrome.runtime.getURL('COMMITHASH'))
})
.finally(() => {
console.log('Loading redux store')
store.ready().then(() => {
console.log('Store loaded.')
document.getElementById('backup-message').remove()
const rootElement = document.getElementById('app')
store
.ready()
.then(() => {
console.log('Store loaded.')
document.getElementById('backup-message').remove()
const rootElement = document.getElementById('app')

window.store = store
window.store = store

const app = rootElement.getAttribute('data-app')
const app = rootElement.getAttribute('data-app')

const root = createRoot(rootElement)
const root = createRoot(rootElement)

if (store.getState().settings.optionalFeatures.writeLogs) {
connectLogger(store, { source: 'monkey.js' })
}
if (store.getState().settings.optionalFeatures.writeLogs) {
connectLogger(store, { source: 'monkey.js' })
}

// updateCurrentPage()
// updateCurrentPage()

const manifest = new Manifest(window.chrome, commitHash)
const manifest = new Manifest(window.chrome, commitHash)

logger('debug', `DemoMonkey ${manifest.version()}`).write()
logger('debug', `DemoMonkey ${manifest.version()}`).write()

const protocolHandler = new ProtocolHandler('web+mnky:')
protocolHandler
.handle(window.location.search)
.catch((error) => {
logger('error', error).write()
window.history.replaceState(
{},
document.title,
window.location.pathname + window.location.hash
)
})
.then((configuration) => {
if (configuration) {
const configurations = store.getState().configurations
store.dispatch({ type: 'ADD_CONFIGURATION', configuration }).then(() => {
const latest = configurations[configurations.length - 1]
store.dispatch({
type: 'SET_CURRENT_VIEW',
view: `configuration/${latest.id}`
})
})
const protocolHandler = new ProtocolHandler('web+mnky:')
protocolHandler
.handle(window.location.search)
.catch((error) => {
logger('error', error).write()
window.history.replaceState(
{},
document.title,
window.location.pathname + window.location.hash
)
}
})
.finally(() => {
switch (app) {
case 'OptionsPageApp':
renderOptionsPageApp(root, store)
break
default:
renderPopupPageApp(root, store, manifest)
}
})
}).catch(e => {
console.log(e)
})
})
.then((configuration) => {
if (configuration) {
const configurations = store.getState().configurations
store.dispatch({ type: 'ADD_CONFIGURATION', configuration }).then(() => {
const latest = configurations[configurations.length - 1]
store.dispatch({
type: 'SET_CURRENT_VIEW',
view: `configuration/${latest.id}`
})
})
window.history.replaceState(
{},
document.title,
window.location.pathname + window.location.hash
)
}
})
.finally(() => {
switch (app) {
case 'OptionsPageApp':
renderOptionsPageApp(root, store)
break
default:
renderPopupPageApp(root, store, manifest)
}
})
})
.catch((e) => {
console.log(e)
})
})
20 changes: 14 additions & 6 deletions src/models/NetRequestManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ class NetRequestManager {
// see https://github.com/svrnm/DemoMonkey/issues/63
this.nextId = this.nextId === -1 ? rules.length + 1 : this.nextId + 1

this.logger('debug', 'Add a new rule with id ' + this.nextId + ' for tab', tabId, 'and rule ', description).write()
this.logger(
'debug',
'Add a new rule with id ' + this.nextId + ' for tab',
tabId,
'and rule ',
description
).write()

const rule = {
id: this.nextId,
Expand Down Expand Up @@ -163,11 +169,13 @@ class NetRequestManager {
clear() {
this.logger('debug', 'Clear all web hooks').write()
this.declarativeNetRequest.getSessionRules((rules) => {
this.declarativeNetRequest.updateSessionRules({
removeRuleIds: rules.map((rule) => rule.id)
}).then(() => {
this.nextId = -1
})
this.declarativeNetRequest
.updateSessionRules({
removeRuleIds: rules.map((rule) => rule.id)
})
.then(() => {
this.nextId = -1
})
})
}
}
Expand Down

0 comments on commit 10a3ac2

Please sign in to comment.