Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nxmad committed Aug 16, 2021
1 parent 04c333b commit 24ba1bb
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 20 deletions.
6 changes: 5 additions & 1 deletion manifest/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Liberton",
"description": "Liberton is free and safe non-custodial Free TON wallet.",
"author": "Alex Balatsky",
"version": "1.1.1",
"version": "1.1.2",
"icons": {
"16": "favicon/favicon-16x16.png",
"32": "favicon/favicon-32x32.png",
Expand All @@ -13,6 +13,10 @@
"default_title": "Liberton",
"default_icon": "favicon/favicon-32x32.png"
},
"background": {
"scripts": ["extension.js"],
"persistent": false
},
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"web_accessible_resources": [
"assets/*"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liberton",
"version": "1.1.1",
"version": "1.1.2",
"description": "Liberton is free and safe non-custodial Free TON wallet.",
"scripts": {
"serve": "vite preview",
Expand Down
13 changes: 13 additions & 0 deletions public/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const hasChrome = typeof chrome !== 'undefined'

const e = hasChrome ? chrome : browser

e.browserAction.onClicked.addListener(function () {
if (e.extension.getExtensionTabs().length) {
return false
}

e.tabs.create({
url: e.runtime.getURL('index.html'),
})
})
6 changes: 5 additions & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Liberton",
"description": "Liberton is free and safe non-custodial Free TON wallet.",
"author": "Alex Balatsky",
"version": "1.1.1",
"version": "1.1.2",
"icons": {
"16": "favicon/favicon-16x16.png",
"32": "favicon/favicon-32x32.png",
Expand All @@ -13,6 +13,10 @@
"default_title": "Liberton",
"default_icon": "favicon/favicon-32x32.png"
},
"background": {
"scripts": ["extension.js"],
"persistent": false
},
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"web_accessible_resources": [
"assets/*"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/account-menu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="account-menu">
<div v-if="current" class="account-menu">
<it-dropdown>
<i class="las la-user account-menu__icon" /> {{ current.name }}

Expand Down
12 changes: 1 addition & 11 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import './assets/scss/app.scss'
*/
import Equal from 'equal-vue'
import { createApp } from 'vue'
import extension from 'extensionizer'

/*
* Override components
Expand All @@ -36,14 +35,7 @@ import { i18n, loadLocaleMessages, setI18nLanguage } from './utils/i18n'
/*
* Features for startup
*/
import { useTon, useNetworking, useDeployments } from '@/features'

/*
* Scripts for browser extension env
*/
if (extension.runtime) {
import('./utils/extension')
}
import { useNetworking } from '@/features'

/*
* Vue app
Expand All @@ -66,8 +58,6 @@ app.component(ButtonOverride.name, ButtonOverride)
* Always load en messages as fallback locale
*/
loadLocaleMessages(i18n, 'en').then(async () => {
const ton = useTon()
const d = useDeployments()
const { runWatcher } = useNetworking()

store.commit('settings/toggleTheme', 'light') // store.state.settings.theme
Expand Down
14 changes: 9 additions & 5 deletions src/utils/extension.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import extension from 'extensionizer'
const hasChrome = typeof chrome !== 'undefined'

extension.browserAction.onClicked.addListener(function (tab) {
if (extension.extension.getExtensionTabs().length) {
const e = hasChrome ? chrome : browser

e.browserAction.onClicked.addListener(function (tab) {
if (e.extension.getExtensionTabs().length) {
return false
}

extension.tabs.create({
url: extension.extension.getBackgroundPage().location.href,
console.log(e.extension.getBackgroundPage())

e.tabs.create({
url: e.extension.getBackgroundPage().location.href,
})
})

0 comments on commit 24ba1bb

Please sign in to comment.