Skip to content

Commit 86477cb

Browse files
committed
fix local download
1 parent 8e695b0 commit 86477cb

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

src/components/Popup/BackupPage.vue

+36-4
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,32 @@
1717
<a-button-link
1818
download="authenticator.txt"
1919
:href="exportOneLineOtpAuthFile"
20-
v-if="!unsupportedAccounts"
20+
v-if="!unsupportedAccounts & isDataLinkSupported"
2121
>{{ i18n.download_backup }}</a-button-link
2222
>
23-
<a-button-link download="authenticator.json" :href="exportFile" v-else>{{
23+
<button v-on:click="downloadBackUpOneLineOtpAuthFile()" v-if="!unsupportedAccounts & !isDataLinkSupported" class="button">
24+
{{ i18n.download_backup }}
25+
</button>
26+
<a-button-link download="authenticator.json" :href="exportFile" v-if="unsupportedAccounts & isDataLinkSupported">{{
2427
i18n.download_backup
2528
}}</a-button-link>
29+
<button v-on:click="downloadBackUpExportFile()" v-if="unsupportedAccounts & !isDataLinkSupported" class="button">{{
30+
i18n.download_backup
31+
}}</button>
2632
<a-button-link
2733
download="authenticator.json"
2834
:href="exportEncryptedFile"
29-
v-if="encryption.getEncryptionStatus()"
35+
v-if="encryption.getEncryptionStatus() & isDataLinkSupported"
3036
>{{ i18n.download_enc_backup }}</a-button-link
3137
>
38+
<button v-on:click="downloadBackUpExportEncryptedFile()" v-if="encryption.getEncryptionStatus() & !isDataLinkSupported" class="button">
39+
{{ i18n.download_enc_backup }}
40+
</button>
3241
</div>
3342
<a-button-link href="import.html">{{ i18n.import_backup }}</a-button-link>
3443
<br />
3544
<!-- 3rd Party Backup Services -->
36-
<div v-show="!backupDisabled">
45+
<div v-show="!backupDisabled & isBackupServiceSupported">
3746
<div class="text">
3847
{{ i18n.storage_sync_info }}
3948
</div>
@@ -46,6 +55,7 @@
4655
</template>
4756
<script lang="ts">
4857
import Vue from "vue";
58+
import { isSafari } from "../../browser";
4959
5060
export default Vue.extend({
5161
data: function () {
@@ -73,6 +83,12 @@ export default Vue.extend({
7383
backupDisabled: function () {
7484
return this.$store.getters["menu/storageArea"];
7585
},
86+
isDataLinkSupported: function () {
87+
return !isSafari;
88+
},
89+
isBackupServiceSupported: function () {
90+
return !isSafari;
91+
}
7692
},
7793
methods: {
7894
showInfo(tab: string) {
@@ -123,6 +139,22 @@ export default Vue.extend({
123139
return;
124140
}
125141
},
142+
downloadBackUpOneLineOtpAuthFile() {
143+
const exportData = this.$store.state.accounts.exportData;
144+
const t = getOneLineOtpBackupFile(exportData);
145+
window.open(t);
146+
},
147+
downloadBackUpExportFile() {
148+
const exportData = this.$store.state.accounts.exportData;
149+
const t = getBackupFile(exportData);
150+
window.open(t);
151+
},
152+
downloadBackUpExportEncryptedFile() {
153+
const exportEncData = this.$store.state.accounts.exportEncData;
154+
const key = this.$store.state.accounts.key;
155+
const t = getBackupFile(exportEncData, key);
156+
window.open(t);
157+
}
126158
},
127159
});
128160

src/components/Popup/MenuPage.vue

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<p
2626
v-bind:title="i18n.backup"
2727
v-on:click="showInfo('BackupPage')"
28-
v-if="isSupported"
2928
>
3029
<span><IconExchange /></span>{{ i18n.backup }}
3130
</p>

webpack.watch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const runTestsAfterBuild = () => {
2222
module.exports = merge(dev, {
2323
mode: 'development',
2424
plugins: [
25-
new ExtensionReloader(),
25+
// new ExtensionReloader(),
2626
runTestsAfterBuild(),
2727
],
2828
watch: true,

0 commit comments

Comments
 (0)