fixed merge conflicts
This commit is contained in:
commit
5d9f81153d
57 changed files with 1600 additions and 646 deletions
|
@ -0,0 +1 @@
|
|||
dd3llxdp5q6ak3zmmicoy3jnodmroouv2xr7whkygiwp3rl7nf23gdad.onion
|
|
@ -19,7 +19,7 @@
|
|||
'''
|
||||
|
||||
# Imports some useful libraries
|
||||
import logger, config, threading, time, uuid, subprocess
|
||||
import logger, config, threading, time, uuid, subprocess, sys
|
||||
from onionrblockapi import Block
|
||||
|
||||
plugin_name = 'cliui'
|
||||
|
@ -31,11 +31,14 @@ class OnionrCLIUI:
|
|||
self.myCore = apiInst.get_core()
|
||||
return
|
||||
|
||||
def subCommand(self, command):
|
||||
def subCommand(self, command, args=None):
|
||||
try:
|
||||
#subprocess.run(["./onionr.py", command])
|
||||
#subprocess.Popen(['./onionr.py', command], stdin=subprocess.STD, stdout=subprocess.STDOUT, stderr=subprocess.STDOUT)
|
||||
subprocess.call(['./onionr.py', command])
|
||||
if args != None:
|
||||
subprocess.call(['./onionr.py', command, args])
|
||||
else:
|
||||
subprocess.call(['./onionr.py', command])
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
|
@ -48,12 +51,11 @@ class OnionrCLIUI:
|
|||
isOnline = 'No'
|
||||
firstRun = True
|
||||
choice = ''
|
||||
|
||||
if self.myCore._utils.localCommand('ping') == 'pong':
|
||||
if self.myCore._utils.localCommand('ping', maxWait=10) == 'pong!':
|
||||
firstRun = False
|
||||
|
||||
while showMenu:
|
||||
if self.myCore._utils.localCommand('ping') == 'pong':
|
||||
if self.myCore._utils.localCommand('ping', maxWait=2) == 'pong!':
|
||||
isOnline = "Yes"
|
||||
else:
|
||||
isOnline = "No"
|
||||
|
@ -62,8 +64,7 @@ class OnionrCLIUI:
|
|||
1. Flow (Anonymous public chat, use at your own risk)
|
||||
2. Mail (Secure email-like service)
|
||||
3. File Sharing
|
||||
4. User Settings
|
||||
5. Quit (Does not shutdown daemon)
|
||||
4. Quit (Does not shutdown daemon)
|
||||
''')
|
||||
try:
|
||||
choice = input(">").strip().lower()
|
||||
|
@ -75,13 +76,9 @@ class OnionrCLIUI:
|
|||
elif choice in ("2", "mail"):
|
||||
self.subCommand("mail")
|
||||
elif choice in ("3", "file sharing", "file"):
|
||||
print("Not supported yet")
|
||||
elif choice in ("4", "user settings", "settings"):
|
||||
try:
|
||||
self.setName()
|
||||
except (KeyboardInterrupt, EOFError) as e:
|
||||
pass
|
||||
elif choice in ("5", "quit"):
|
||||
filename = input("Enter full path to file: ").strip()
|
||||
self.subCommand("addfile", filename)
|
||||
elif choice in ("4", "quit"):
|
||||
showMenu = False
|
||||
elif choice == "":
|
||||
pass
|
||||
|
@ -89,14 +86,6 @@ class OnionrCLIUI:
|
|||
logger.error("Invalid choice")
|
||||
return
|
||||
|
||||
def setName(self):
|
||||
try:
|
||||
name = input("Enter your name: ")
|
||||
if name != "":
|
||||
self.myCore.insertBlock("userInfo-" + str(uuid.uuid1()), sign=True, header='userInfo', meta={'name': name})
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
return
|
||||
|
||||
def on_init(api, data = None):
|
||||
'''
|
||||
|
|
|
@ -54,9 +54,10 @@ class OnionrFlow:
|
|||
self.flowRunning = False
|
||||
expireTime = self.myCore._utils.getEpoch() + 43200
|
||||
if len(message) > 0:
|
||||
insertBL = Block(content = message, type = 'txt', expire=expireTime, core = self.myCore)
|
||||
insertBL.setMetadata('ch', self.channel)
|
||||
insertBL.save()
|
||||
self.myCore.insertBlock(message, header='txt', expire=expireTime, meta={'ch': self.channel})
|
||||
#insertBL = Block(content = message, type = 'txt', expire=expireTime, core = self.myCore)
|
||||
#insertBL.setMetadata('ch', self.channel)
|
||||
#insertBL.save()
|
||||
|
||||
logger.info("Flow is exiting, goodbye")
|
||||
return
|
||||
|
@ -66,10 +67,13 @@ class OnionrFlow:
|
|||
time.sleep(1)
|
||||
try:
|
||||
while self.flowRunning:
|
||||
for block in Block.getBlocks(type = 'txt', core = self.myCore):
|
||||
for block in self.myCore.getBlocksByType('txt'):
|
||||
block = Block(block)
|
||||
if block.getMetadata('ch') != self.channel:
|
||||
#print('not chan', block.getMetadata('ch'))
|
||||
continue
|
||||
if block.getHash() in self.alreadyOutputed:
|
||||
#print('already')
|
||||
continue
|
||||
if not self.flowRunning:
|
||||
break
|
||||
|
@ -79,7 +83,7 @@ class OnionrFlow:
|
|||
content = self.myCore._utils.escapeAnsi(content.replace('\n', '\\n').replace('\r', '\\r').strip())
|
||||
logger.info(block.getDate().strftime("%m/%d %H:%M") + ' - ' + logger.colors.reset + content, prompt = False)
|
||||
self.alreadyOutputed.append(block.getHash())
|
||||
time.sleep(5)
|
||||
time.sleep(5)
|
||||
except KeyboardInterrupt:
|
||||
self.flowRunning = False
|
||||
|
||||
|
|
|
@ -28,24 +28,6 @@ plugin_name = 'metadataprocessor'
|
|||
|
||||
# event listeners
|
||||
|
||||
def _processUserInfo(api, newBlock):
|
||||
'''
|
||||
Set the username for a particular user, from a signed block by them
|
||||
'''
|
||||
myBlock = newBlock
|
||||
peerName = myBlock.getMetadata('name')
|
||||
try:
|
||||
if len(peerName) > 20:
|
||||
raise onionrexceptions.InvalidMetdata('Peer name specified is too large')
|
||||
except TypeError:
|
||||
pass
|
||||
except onionrexceptions.InvalidMetadata:
|
||||
pass
|
||||
else:
|
||||
if signer in self.api.get_core().listPeers():
|
||||
api.get_core().setPeerInfo(signer, 'name', peerName)
|
||||
logger.info('%s is now using the name %s.' % (signer, api.get_utils().escapeAnsi(peerName)))
|
||||
|
||||
def _processForwardKey(api, myBlock):
|
||||
'''
|
||||
Get the forward secrecy key specified by the user for us to use
|
||||
|
@ -67,12 +49,8 @@ def on_processblocks(api):
|
|||
|
||||
# Process specific block types
|
||||
|
||||
# userInfo blocks, such as for setting username
|
||||
if blockType == 'userInfo':
|
||||
if api.data['validSig'] == True: # we use == True for type safety
|
||||
_processUserInfo(api, myBlock)
|
||||
# forwardKey blocks, add a new forward secrecy key for a peer
|
||||
elif blockType == 'forwardKey':
|
||||
if blockType == 'forwardKey':
|
||||
if api.data['validSig'] == True:
|
||||
_processForwardKey(api, myBlock)
|
||||
# socket blocks
|
||||
|
|
|
@ -74,6 +74,7 @@ class OnionrMail:
|
|||
logger.info('Decrypting messages...')
|
||||
choice = ''
|
||||
displayList = []
|
||||
subject = ''
|
||||
|
||||
# this could use a lot of memory if someone has recieved a lot of messages
|
||||
for blockHash in self.myCore.getBlocksByType('pm'):
|
||||
|
@ -97,7 +98,12 @@ class OnionrMail:
|
|||
senderDisplay = senderKey
|
||||
|
||||
blockDate = pmBlocks[blockHash].getDate().strftime("%m/%d %H:%M")
|
||||
displayList.append('%s. %s - %s: %s' % (blockCount, blockDate, senderDisplay[:12], blockHash))
|
||||
try:
|
||||
subject = pmBlocks[blockHash].bmetadata['subject']
|
||||
except KeyError:
|
||||
subject = ''
|
||||
|
||||
displayList.append('%s. %s - %s - <%s>: %s' % (blockCount, blockDate, senderDisplay[:12], subject[:10], blockHash))
|
||||
while choice not in ('-q', 'q', 'quit'):
|
||||
for i in displayList:
|
||||
logger.info(i)
|
||||
|
@ -188,6 +194,7 @@ class OnionrMail:
|
|||
def draftMessage(self, recip=''):
|
||||
message = ''
|
||||
newLine = ''
|
||||
subject = ''
|
||||
entering = False
|
||||
if len(recip) == 0:
|
||||
entering = True
|
||||
|
@ -207,22 +214,31 @@ class OnionrMail:
|
|||
else:
|
||||
# if -q or ctrl-c/d, exit function here, otherwise we successfully got the public key
|
||||
return
|
||||
|
||||
logger.info('Enter your message, stop by entering -q on a new line.')
|
||||
try:
|
||||
subject = logger.readline('Message subject: ')
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
pass
|
||||
|
||||
cancelEnter = False
|
||||
logger.info('Enter your message, stop by entering -q on a new line. -c to cancel')
|
||||
while newLine != '-q':
|
||||
try:
|
||||
newLine = input()
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
pass
|
||||
cancelEnter = True
|
||||
if newLine == '-c':
|
||||
cancelEnter = True
|
||||
break
|
||||
if newLine == '-q':
|
||||
continue
|
||||
newLine += '\n'
|
||||
message += newLine
|
||||
|
||||
logger.info('Inserting encrypted message as Onionr block....')
|
||||
if not cancelEnter:
|
||||
logger.info('Inserting encrypted message as Onionr block....')
|
||||
|
||||
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True)
|
||||
self.sentboxTools.addToSent(blockID, recip, message)
|
||||
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True, meta={'subject': subject})
|
||||
self.sentboxTools.addToSent(blockID, recip, message)
|
||||
def menu(self):
|
||||
choice = ''
|
||||
while True:
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
{
|
||||
"general" : {
|
||||
"dev_mode" : true,
|
||||
"display_header" : true,
|
||||
"minimum_block_pow": 5,
|
||||
"minimum_send_pow": 5,
|
||||
"display_header" : false,
|
||||
"minimum_block_pow": 1,
|
||||
"minimum_send_pow": 1,
|
||||
"socket_servers": false,
|
||||
"security_level": 0,
|
||||
"max_block_age": 2678400,
|
||||
<<<<<<< HEAD
|
||||
"public_key": "",
|
||||
"use_new_api_server": false
|
||||
=======
|
||||
"bypass_tor_check": false,
|
||||
"public_key": ""
|
||||
>>>>>>> pom
|
||||
},
|
||||
|
||||
"www" : {
|
||||
|
@ -50,7 +55,7 @@
|
|||
|
||||
"file": {
|
||||
"output": true,
|
||||
"path": "data/output.log"
|
||||
"path": "output.log"
|
||||
},
|
||||
|
||||
"console" : {
|
||||
|
@ -70,7 +75,7 @@
|
|||
},
|
||||
|
||||
"allocations" : {
|
||||
"disk" : 10000000000,
|
||||
"disk" : 100000000,
|
||||
"net_total" : 1000000000,
|
||||
"blockCache" : 5000000,
|
||||
"blockCacheTotal" : 50000000
|
||||
|
@ -79,7 +84,7 @@
|
|||
"peers" : {
|
||||
"minimum_score" : -100,
|
||||
"max_stored_peers" : 5000,
|
||||
"max_connect" : 10
|
||||
"max_connect" : 1000
|
||||
},
|
||||
|
||||
"timers" : {
|
||||
|
|
58
onionr/static-data/www/board/board.js
Normal file
58
onionr/static-data/www/board/board.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
webpassword = ''
|
||||
requested = []
|
||||
|
||||
document.getElementById('webpassWindow').style.display = 'block';
|
||||
|
||||
var windowHeight = window.innerHeight;
|
||||
document.getElementById('webpassWindow').style.height = windowHeight + "px";
|
||||
|
||||
function httpGet(theUrl) {
|
||||
var xmlHttp = new XMLHttpRequest()
|
||||
xmlHttp.open( "GET", theUrl, false ) // false for synchronous request
|
||||
xmlHttp.setRequestHeader('token', webpassword)
|
||||
xmlHttp.send( null )
|
||||
if (xmlHttp.status == 200){
|
||||
return xmlHttp.responseText
|
||||
}
|
||||
else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function appendMessages(msg){
|
||||
el = document.createElement('div')
|
||||
el.className = 'entry'
|
||||
el.innerText = msg
|
||||
document.getElementById('feed').appendChild(el)
|
||||
document.getElementById('feed').appendChild(document.createElement('br'))
|
||||
}
|
||||
|
||||
function getBlocks(){
|
||||
if (document.getElementById('none') !== null){
|
||||
document.getElementById('none').remove();
|
||||
|
||||
}
|
||||
var feedText = httpGet('/getblocksbytype/txt')
|
||||
var blockList = feedText.split(',')
|
||||
for (i = 0; i < blockList.length; i++){
|
||||
if (! requested.includes(blockList[i])){
|
||||
bl = httpGet('/gethtmlsafeblockdata/' + blockList[i])
|
||||
appendMessages(bl)
|
||||
requested.push(blockList[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('registerPassword').onclick = function(){
|
||||
webpassword = document.getElementById('webpassword').value
|
||||
if (httpGet('/ping') === 'pong!'){
|
||||
document.getElementById('webpassWindow').style.display = 'none'
|
||||
getBlocks()
|
||||
}
|
||||
else{
|
||||
alert('Sorry, but that password appears invalid.')
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('refreshFeed').onclick = function(){
|
||||
getBlocks()
|
||||
}
|
22
onionr/static-data/www/board/index.html
Normal file
22
onionr/static-data/www/board/index.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||
<title>
|
||||
OnionrBoard
|
||||
</title>
|
||||
<link rel='stylesheet' href='theme.css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id='webpassWindow' class='hidden'>
|
||||
<p>Welcome to OnionrBoard</p>
|
||||
<p>Please enter the webpassword. You can get this from running the 'details' command in Onionr.</p>
|
||||
<input id='webpassword' type='password' placeholder="Web password for daemon" value='CBF15ED9782FB482339E5F5B9DDCF3E58E523E71E8E9EF480596817AB5EA2E63'>
|
||||
<button id='registerPassword'>Unlock Onionr</button>
|
||||
</div>
|
||||
<input type='button' id='refreshFeed' value='Refresh Feed'>
|
||||
<div id='feed'><span id='none'>None Yet :)</span></div>
|
||||
<script src='board.js'></script>
|
||||
</body>
|
||||
</html>
|
31
onionr/static-data/www/board/theme.css
Normal file
31
onionr/static-data/www/board/theme.css
Normal file
|
@ -0,0 +1,31 @@
|
|||
h1, h2, h3{
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
p{
|
||||
font-family: sans-serif;
|
||||
}
|
||||
#webpassWindow{
|
||||
background-color: black;
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.entry{
|
||||
color: red;
|
||||
}
|
||||
|
||||
#feed{
|
||||
margin-left: 2%;
|
||||
margin-right: 25%;
|
||||
margin-top: 1em;
|
||||
border: 2px solid black;
|
||||
padding: 5px;
|
||||
min-height: 50px;
|
||||
}
|
24
onionr/static-data/www/mail/index.html
Normal file
24
onionr/static-data/www/mail/index.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>
|
||||
Onionr Mail
|
||||
</title>
|
||||
<link rel='stylesheet' href='/shared/style/modal.css'>
|
||||
<link rel='stylesheet' href='/shared/main/style.css'>
|
||||
<link rel='stylesheet' href='/mail/mail.css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id="infoOverlay" class='overlay'>
|
||||
</div>
|
||||
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
|
||||
<span class='logoText'>Onionr Mail</span>
|
||||
<div class='content'>
|
||||
<button class='refresh'>Refresh</button>
|
||||
<div id='threads' class='threads'></div>
|
||||
</div>
|
||||
<script src='/shared/misc.js'></script>
|
||||
<script src='/mail/mail.js'></script>
|
||||
</body>
|
||||
</html>
|
7
onionr/static-data/www/mail/mail.css
Normal file
7
onionr/static-data/www/mail/mail.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.threads div{
|
||||
padding-top: 1em;
|
||||
}
|
||||
.threads div span{
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
52
onionr/static-data/www/mail/mail.js
Normal file
52
onionr/static-data/www/mail/mail.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
pms = ''
|
||||
threadPart = document.getElementById('threads')
|
||||
function getInbox(){
|
||||
for(var i = 0; i < pms.length; i++) {
|
||||
fetch('/getblockdata/' + pms[i], {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.json()) // Transform the data into json
|
||||
.then(function(resp) {
|
||||
|
||||
var entry = document.createElement('div')
|
||||
|
||||
var bHashDisplay = document.createElement('a')
|
||||
var senderInput = document.createElement('input')
|
||||
var subjectLine = document.createElement('span')
|
||||
var dateStr = document.createElement('span')
|
||||
var humanDate = new Date(0)
|
||||
humanDate.setUTCSeconds(resp['meta']['time'])
|
||||
senderInput.value = resp['meta']['signer']
|
||||
bHashDisplay.innerText = pms[i - 1].substring(0, 10)
|
||||
bHashDisplay.setAttribute('hash', pms[i - 1]);
|
||||
senderInput.readOnly = true
|
||||
dateStr.innerText = humanDate.toString()
|
||||
if (resp['metadata']['subject'] === undefined || resp['metadata']['subject'] === null) {
|
||||
subjectLine.innerText = '()'
|
||||
}
|
||||
else{
|
||||
subjectLine.innerText = '(' + resp['metadata']['subject'] + ')'
|
||||
}
|
||||
//entry.innerHTML = 'sender ' + resp['meta']['signer'] + ' - ' + resp['meta']['time']
|
||||
threadPart.appendChild(entry)
|
||||
entry.appendChild(bHashDisplay)
|
||||
entry.appendChild(senderInput)
|
||||
entry.appendChild(subjectLine)
|
||||
entry.appendChild(dateStr)
|
||||
|
||||
}.bind([pms, i]))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fetch('/getblocksbytype/pm', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.text()) // Transform the data into json
|
||||
.then(function(data) {
|
||||
pms = data.split(',')
|
||||
getInbox(pms)
|
||||
})
|
||||
|
33
onionr/static-data/www/private/index.html
Normal file
33
onionr/static-data/www/private/index.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>
|
||||
Onionr
|
||||
</title>
|
||||
<link rel='stylesheet' href='/shared/style/modal.css'>
|
||||
<link rel='stylesheet' href='/shared/main/style.css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id="shutdownNotice" class='overlay'>
|
||||
<div>
|
||||
<p>Your node will shutdown. Thank you for using Onionr.</p>
|
||||
</div>
|
||||
</div>
|
||||
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
|
||||
<span class='logoText'>Onionr Web Control Panel</span>
|
||||
<div class='content'>
|
||||
<button id='shutdownNode'>Shutdown Node</button> <button id='refreshStats'>Refresh Stats</button>
|
||||
<br><br><a class='idLink' href='/mail/'>Mail</a>
|
||||
<h2>Stats</h2>
|
||||
<p>Uptime: <span id='uptime'></span></p>
|
||||
<p>Stored Blocks: <span id='storedBlocks'></span></p>
|
||||
<p>Blocks in queue: <span id='blockQueue'></span></p>
|
||||
<p>Connected nodes:</p>
|
||||
<pre id='connectedNodes'></pre>
|
||||
</div>
|
||||
<script src='/shared/misc.js'></script>
|
||||
<script src='/shared/main/stats.js'></script>
|
||||
<script src='/shared/panel.js'></script>
|
||||
</body>
|
||||
</html>
|
32
onionr/static-data/www/shared/main/stats.js
Normal file
32
onionr/static-data/www/shared/main/stats.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
|
||||
This file loads stats to show on the main node web page
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
uptimeDisplay = document.getElementById('uptime')
|
||||
connectedDisplay = document.getElementById('connectedNodes')
|
||||
storedBlockDisplay = document.getElementById('storedBlocks')
|
||||
queuedBlockDisplay = document.getElementById('blockQueue')
|
||||
|
||||
function getStats(){
|
||||
stats = JSON.parse(httpGet('getstats', webpass))
|
||||
uptimeDisplay.innerText = stats['uptime'] + ' seconds'
|
||||
connectedDisplay.innerText = stats['connectedNodes']
|
||||
storedBlockDisplay.innerText = stats['blockCount']
|
||||
queuedBlockDisplay.innerText = stats['blockQueueCount']
|
||||
}
|
||||
getStats()
|
140
onionr/static-data/www/shared/main/style.css
Normal file
140
onionr/static-data/www/shared/main/style.css
Normal file
|
@ -0,0 +1,140 @@
|
|||
body{
|
||||
background-color: #2c2b3f;
|
||||
color: white;
|
||||
}
|
||||
|
||||
a, a:visited{
|
||||
color: white;
|
||||
}
|
||||
.center{
|
||||
text-align: center;
|
||||
}
|
||||
footer{
|
||||
margin-top: 2em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
body{
|
||||
margin-left: 3em;
|
||||
padding: 1em;
|
||||
}
|
||||
.onionrMenu{
|
||||
max-width: 25%;
|
||||
margin-left: 2%;
|
||||
margin-right: 10%;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.onionrMenu li{
|
||||
list-style-type: none;
|
||||
margin-top: 3px;
|
||||
font-size: 125%;
|
||||
}
|
||||
.onionrMenu li:hover{
|
||||
color: red;
|
||||
}
|
||||
.box {
|
||||
display: flex;
|
||||
align-items:center;
|
||||
}
|
||||
.logo{
|
||||
max-width: 25%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.logoText{
|
||||
font-family: sans-serif;
|
||||
font-size: 2em;
|
||||
margin-top: 1em;
|
||||
margin-left: 1%;
|
||||
}
|
||||
.main{
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.content{
|
||||
margin-top: 3em;
|
||||
margin-left: 0%;
|
||||
margin-right: 40%;
|
||||
background-color: white;
|
||||
color: black;
|
||||
padding-right: 5%;
|
||||
padding-left: 3%;
|
||||
padding-bottom: 2em;
|
||||
padding-top: 0.5em;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
min-height: 300px;
|
||||
}
|
||||
.content p{
|
||||
text-align: justify;
|
||||
}
|
||||
.content img{
|
||||
max-width: 35%;
|
||||
}
|
||||
.content a, .content a:visited{
|
||||
color: black;
|
||||
}
|
||||
|
||||
.stats{
|
||||
margin-top: 1em;
|
||||
background-color: #0c1049;
|
||||
padding: 5px;
|
||||
margin-right: 45%;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.statDesc{
|
||||
background-color: black;
|
||||
padding: 5px;
|
||||
margin-right: 1%;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.stats noscript{
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.statItem{
|
||||
padding-left: 10px;
|
||||
float: right;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.warn{
|
||||
color: orangered;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.onionrMenu{
|
||||
margin-left: 0%;
|
||||
}
|
||||
body{
|
||||
margin-left: 0em;
|
||||
}
|
||||
.content{
|
||||
margin-left: 1%;
|
||||
margin-right: 2%;
|
||||
}
|
||||
.content img{
|
||||
max-width: 85%;
|
||||
}
|
||||
.stats{
|
||||
margin-right: 1%;
|
||||
}
|
||||
.statItem{
|
||||
float: initial;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/*https://stackoverflow.com/a/16778646*/
|
||||
.overlay {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width:100%;
|
||||
opacity: 0.9;
|
||||
height:100%;
|
||||
text-align:center;
|
||||
z-index: 1000;
|
||||
background-color: black;
|
||||
}
|
44
onionr/static-data/www/shared/misc.js
Normal file
44
onionr/static-data/www/shared/misc.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
webpass = document.location.hash.replace('#', '')
|
||||
nowebpass = false
|
||||
if (typeof webpass == "undefined"){
|
||||
webpass = localStorage['webpass']
|
||||
}
|
||||
else{
|
||||
localStorage['webpass'] = webpass
|
||||
//document.location.hash = ''
|
||||
}
|
||||
if (typeof webpass == "undefined" || webpass == ""){
|
||||
alert('Web password was not found in memory or URL')
|
||||
nowebpass = true
|
||||
}
|
||||
|
||||
function httpGet(theUrl) {
|
||||
var xmlHttp = new XMLHttpRequest()
|
||||
xmlHttp.open( "GET", theUrl, false ) // false for synchronous request
|
||||
xmlHttp.setRequestHeader('token', webpass)
|
||||
xmlHttp.send( null )
|
||||
if (xmlHttp.status == 200){
|
||||
return xmlHttp.responseText
|
||||
}
|
||||
else{
|
||||
return ""
|
||||
}
|
||||
}
|
||||
function overlay(overlayID) {
|
||||
el = document.getElementById(overlayID)
|
||||
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"
|
||||
}
|
||||
|
||||
var passLinks = document.getElementsByClassName("idLink")
|
||||
for(var i = 0; i < passLinks.length; i++) {
|
||||
passLinks[i].href += '#' + webpass
|
||||
}
|
||||
|
||||
var refreshLinks = document.getElementsByClassName("refresh")
|
||||
|
||||
for(var i = 0; i < refreshLinks.length; i++) {
|
||||
//Can't use .reload because of webpass
|
||||
refreshLinks[i].onclick = function(){
|
||||
location.reload()
|
||||
}
|
||||
}
|
BIN
onionr/static-data/www/shared/onionr-icon.png
Normal file
BIN
onionr/static-data/www/shared/onionr-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
7
onionr/static-data/www/shared/onionrblocks.js
Normal file
7
onionr/static-data/www/shared/onionrblocks.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Block {
|
||||
constructor(hash, raw) {
|
||||
this.hash = hash;
|
||||
this.raw = raw;
|
||||
}
|
||||
}
|
||||
|
12
onionr/static-data/www/shared/panel.js
Normal file
12
onionr/static-data/www/shared/panel.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
shutdownBtn = document.getElementById('shutdownNode')
|
||||
refreshStatsBtn = document.getElementById('refreshStats')
|
||||
shutdownBtn.onclick = function(){
|
||||
if (! nowebpass){
|
||||
httpGet('shutdownclean')
|
||||
overlay('shutdownNotice')
|
||||
}
|
||||
}
|
||||
|
||||
refreshStatsBtn.onclick = function(){
|
||||
getStats()
|
||||
}
|
2
onionr/static-data/www/ui/dist/js/main.js
vendored
2
onionr/static-data/www/ui/dist/js/main.js
vendored
|
@ -704,7 +704,7 @@ if(tt !== null && tt !== undefined) {
|
|||
if(getWebPassword() === null) {
|
||||
var password = "";
|
||||
while(password.length != 64) {
|
||||
password = prompt("Please enter the web password (run `./RUN-LINUX.sh --get-password`)");
|
||||
password = prompt("Please enter the web password (run `./RUN-LINUX.sh --details`)");
|
||||
}
|
||||
|
||||
setWebPassword(password);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue