-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div class="p-3"> | ||
<router-view></router-view> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import browser from "webextension-polyfill"; | ||
import Vue from 'vue' | ||
import VueRouter from 'vuerouter' | ||
import Quasar from 'quasar' | ||
import App from '../../components/App.vue' | ||
import routes from './routes' | ||
|
||
// Mozilla's polyfill | ||
Vue.prototype.$browser = browser | ||
Vue.use(VueRouter) | ||
Vue.use(Quasar) | ||
|
||
async function init(elementId = 'app') { | ||
const router = new VueRouter({ | ||
routes | ||
}) | ||
|
||
// TODO: extract | ||
const serverResult = await browser.storage.sync.get({ | ||
serverUrl: '' | ||
}) | ||
const serverUrl = serverResult.serverUrl | ||
|
||
const result = await browser.storage.sync.get({ | ||
user: '' | ||
}) | ||
const user = result.user | ||
|
||
if (serverUrl && user && user.id && user.wallets && user.wallets.length) { | ||
router.replace({ | ||
path: 'lnbits', | ||
query: { | ||
userId: user.id, | ||
walletId: user.wallets[0].id | ||
}, | ||
}) | ||
} else { | ||
router.replace('/connect') | ||
} | ||
|
||
|
||
new Vue({ | ||
el: `#${elementId}`, | ||
router, | ||
render: (h) => h(App), | ||
}) | ||
} | ||
|
||
export default init |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,3 @@ | ||
import Vue from 'vue' | ||
import VueRouter from 'vuerouter' | ||
import Quasar from 'quasar' | ||
import Options from '../../components/Options.vue' | ||
import routes from './routes' | ||
import app from '../app/app' | ||
|
||
|
||
// Mozilla's polyfill | ||
Vue.prototype.$browser = require('webextension-polyfill') | ||
Vue.use(VueRouter) | ||
Vue.use(Quasar) | ||
|
||
|
||
const router = new VueRouter({ | ||
routes | ||
}) | ||
router.replace('/foo') | ||
|
||
new Vue({ | ||
el: '#options', | ||
router, | ||
render: (h) => h(Options), | ||
}) | ||
app('options') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,3 @@ | ||
import browser from "webextension-polyfill"; | ||
import Vue from 'vue' | ||
import VueRouter from 'vuerouter' | ||
import Quasar from 'quasar' | ||
import Popup from '../../components/Popup.vue' | ||
import routes from './routes' | ||
import app from '../app/app' | ||
|
||
// Mozilla's polyfill | ||
Vue.prototype.$browser = browser | ||
Vue.use(VueRouter) | ||
Vue.use(Quasar) | ||
|
||
async function init() { | ||
const router = new VueRouter({ | ||
routes | ||
}) | ||
|
||
// TODO: extract | ||
const serverResult = await browser.storage.sync.get({ | ||
serverUrl: '' | ||
}) | ||
const serverUrl = serverResult.serverUrl | ||
|
||
const result = await browser.storage.sync.get({ | ||
user: '' | ||
}) | ||
const user = result.user | ||
|
||
if (serverUrl && user && user.id && user.wallets && user.wallets.length) { | ||
router.replace({ | ||
path: 'lnbits', | ||
query: { | ||
userId: user.id, | ||
walletId: user.wallets[0].id | ||
}, | ||
}) | ||
} else { | ||
router.replace('/connect') | ||
} | ||
|
||
|
||
new Vue({ | ||
el: '#popup', | ||
router, | ||
render: (h) => h(Popup), | ||
}) | ||
} | ||
|
||
init() | ||
app('popup') |