-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.js
128 lines (126 loc) · 4.76 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
new Vue({
el: '#app',
data: {
platform: '',
path: '',
conf: '',
peersList: [
'explorer.myhush.org',
'stilgar.leto.net',
'dnsseed.bleuzero.com',
'dnsseed.hush.quebec'
],
optionDaemon: 1,
optionServer: 1,
optionTor: 0,
optionGen: 0,
optionGenProcLimit: 2,
optionEquihashSolver: 'tromp',
optionWhiteList: [],
tempWhitelist: '',
customPath: 0,
customMinerToAddress: 0,
optionMinerAddress: '',
optionRpcAllowIp: '127.0.0.1',
optionRpcUser: 'rpcuser',
optionRpcPassword: Math.random().toString(36).slice(2),
optionShowMetrics: 0,
optionDataDir: '',
optionAddrIndex: 1,
optionSpentIndex: 1,
optionTimestampIndex: 1
},
methods: {
setPlatform: function (option) {
this.platform = option
if (this.platform == 'Linux') {
this.path = '/home/user/.komodo/HUSH3.conf'
} else if (this.platform == "Mac OS") {
this.path = '~/Library/Application Support/Komodo/HUSH3.conf'
} else {
this.path = 'C:\\Users\\your_username\\AppData\\Roaming\\Komodo\\HUSH3.conf'
}
$('.platform-banner').show()
$(document.body).animate({
'scrollTop': $('#build').offset().top
}, 1200);
},
showPathInput: function () {
$('#paths').toggle()
},
pickPath: function () {
},
showMinerInfo: function () {
$('#threads').toggle()
$('#minerAddress').toggle()
if (this.customMinerToAddress == 1) {
$('#minerInput').toggle()
}
},
showMinerAddress: function () {
$('#minerInput').toggle()
},
decreaseThreads: function () {
if (this.optionGenProcLimit != 0) {
this.optionGenProcLimit--
}
},
increaseThreads: function () {
this.optionGenProcLimit++
},
addWhiteList: function (value) {
this.optionWhiteList.push(value)
this.tempWhitelist = ''
},
removeWhiteListItem: function (item) {
console.log(item)
var index = this.optionWhiteList.indexOf(item)
this.optionWhiteList.splice(index, 1)
},
compile: function () {
var currentdate = new Date();
var compileTime = currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds()
this.conf =
"# HUSH Configuration File<br /><br /># This file has been automatically generated by Hush Config Generator. It may be further customized by hand only.<br /><br /># Creation date: " + compileTime + "<br /><br /># The rpcuser/rpcpassword are used for the local call to hushd. The rpcpassword was randomly set.<br /><br /># Start Hush Configuration<br /><br />daemon=" + this.optionDaemon + "<br />server=" + this.optionServer + "<br />rpcallowip=" + this.optionRpcAllowIp + "<br />rpcuser=" + this.optionRpcUser + "<br />rpcpassword=" + this.optionRpcPassword
if (this.optionWhiteList.length != 0) {
this.conf = this.conf + "<br /><br />whitelist=" + this.optionWhiteList
}
if (this.customPath == 1) {
this.conf = this.conf + "<br /><br />datadir=" + this.optionDataDir
}
if (this.optionGen == 1) {
this.conf = this.conf + "<br /><br />gen=1<br />genproclimit=" + this.optionGenProcLimit + "<br />equihashsolver=tromp"
}
if (this.customMinerToAddress == 1) {
this.conf = this.conf + "<br />mineraddress=" + this.optionMinerAddress
}
if (this.optionAddrIndex == 1) {
this.conf = this.conf + "<br /><br />addressindex=1"
}
if (this.optionSpentIndex == 1) {
this.conf = this.conf + "<br />spentindex=1"
}
if (this.optionTimestampIndex == 1) {
this.conf = this.conf + "<br />timestampindex=1"
}
if (this.optionAddrIndex == 1) {
this.conf = this.conf + "<br /><br />showmetrics=1"
}
for (var i = 0; i< this.peersList.length; i++) {
if (i == 0) {
this.conf = this.conf + "<br />"
}
this.conf = this.conf + "<br />addnode=" + this.peersList[i]
}
if (this.optionTor == 1) {
this.conf = this.conf + "<br />addnode=hushnodexptkgea3.onion"
}
$('#profile').show()
}
}
});