Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
fix registry file config
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Nov 3, 2020
1 parent 38fee58 commit 98a7df1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export default {
},
methods: {
async onSelectDir() {
const { filePaths } = await dialog.showOpenDialog({ title: 'Select Your Registry Location', buttonLabel: 'Select', properties: ['openDirectory'] });
const { filePath } = await dialog.showSaveDialog({ title: 'Select Your Registry Location', defaultPath: 'registry.dat', nameFieldLabel: 'Filename', buttonLabel: 'Select' });
this.path = filePaths ? filePaths[0] : null;
this.path = filePath || '';
this.$emit('change', this.path);
}
Expand Down
21 changes: 15 additions & 6 deletions src/views/pages/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
<template slot="title">Registry Size</template>
<template slot="description">The size of the Skynet Registry. The Skynet Registry is a key value store for linking uploaded data to a constant key. Hosts are payed much more than the resources actually consumed. Make sure that you have enough free space on your disk before allocating the registry. <span class="suggestion">Suggested: 4GB</span></template>
</size-item>
<directory-item :value="registryPath" @change="onChangeValue('customregistrypath', $event)">
<template slot="title">Custom Registry Path</template>
<file-item :value="registryPath" @change="onChangeRegPath('customregistrypath', $event)">
<template slot="title">Custom Registry Location</template>
<template slot="description">The location of the Skynet Registry on disk, leave blank for default. Defaults to your Sia data path, usually the disk your operating system is installed on.</template>
</directory-item>
</file-item>
<div class="config-header">Advanced</div>
<price-item :value="baseRPCPrice" :average="averageSettings.base_rpc_price" :pinned="isPinned('minbaserpcprice')" @change="onChangePrice('minbaserpcprice', $event)">
<template slot="title">Base RPC Price</template>
Expand All @@ -81,6 +81,7 @@

<script>
import log from 'electron-log';
import path from 'path';
import BigNumber from 'bignumber.js';
import { mapState, mapActions } from 'vuex';
import { writeConfig } from '@/utils';
Expand All @@ -91,13 +92,13 @@ import { refreshHostConfig } from '@/sync/config';
import AnnounceHostModal from '@/components/config/AnnounceHostModal';
import PriceItem from '@/components/config/PriceItem';
import SizeItem from '@/components/config/SizeItem';
import DirectoryItem from '@/components/config/DirectoryItem';
import FileItem from '@/components/config/FileItem';
import DurationItem from '@/components/config/DurationItem';
export default {
components: {
AnnounceHostModal,
DirectoryItem,
FileItem,
DurationItem,
PriceItem,
SizeItem
Expand Down Expand Up @@ -226,6 +227,14 @@ export default {
console.error(`Config.onChangeSize (${key})`, ex);
}
},
onChangeRegPath(key, value) {
try {
this.config[key] = path.join(value, 'registry.dat');
this.changed = true;
} catch (ex) {
console.error(`Config.onChangeSize (${key})`, ex);
}
},
async onClickUpdate() {
if (this.updating)
return;
Expand All @@ -239,7 +248,7 @@ export default {
await client.updateHost({
...this.config,
windowsize: 144,
maxcollateral: this.convertRawValue(this.collateral, 'collateral').times(4).toFixed(0).toString(10)
maxcollateral: this.convertRawValue(this.collateral, 'collateral').times(1e12).times(4320).times(4).toFixed(0).toString(10)
});
for (let pin in this.pinned) {
Expand Down

0 comments on commit 98a7df1

Please sign in to comment.