lots of stuff started and changed... in theory

master
Rob Foraker 1 year ago
parent b45b5ed2df
commit 01b207a5ef

@ -4,7 +4,15 @@ A $HIVE powered social profile
Static Site files are located in ./docs/ upon building,
https://personal.community/ runs on GitHub pages using this repo.
Source files for editing are in ./src/
Source files f
# TODO
refactor page selector (tag !== "null")
fix tags display bug on new post (index newpost div)
blokzlock()
blokzlock private key for (new post, edit profile, comment, vote, ???)
add some 'did i break something' tests
more on yellow post-it notes
# Installation
to get started, clone repo with:

@ -62,7 +62,7 @@
<script src="../js/mdl-chips-input.js" type="application/javascript"></script>
<div style="position: fixed; right: 20px; top: 20px"><small><i class='material-icons' onclick='share()' style='cursor: pointer;'>share</i></small></div>
<div style="position: fixed; right: 20px; top: 20px" id="share"><small><i class='material-icons' onclick='share()' style='cursor: pointer;'>share</i></small></div>
<div id="profile" style="padding-right: 1em; padding-left: 1em;"></div>
@ -193,6 +193,29 @@ data-upgraded=",MaterialButton,MaterialRipple">Submit</button></div>
</div>
<dialog class="mdl-dialog">
<h4 class="mdl-dialog__title">Verification</h4>
<div class="mdl-dialog__content">
<p>
Store your private posting key encrypted until you verify a session code.
</p>
<div class="verifiedusers"></div>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button" onclick='blokzlock();localStorage.setItem("verified", "true");location.reload()'>Add Key</button>
<button type="button" class="mdl-button close"><i class='material-icons'>close</i></button>
</div>
</dialog>
<button id="blokztop" class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab"
style="background-color: #ddd;">
<i class="material-icons" onclick="javascript:location.href='#'">keyboard_arrow_up</i>
@ -218,7 +241,7 @@ data-upgraded=",MaterialButton,MaterialRipple">Submit</button></div>
<div id="loggedin">
<form id="frm2" action="/">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="font-size: 1.25em;">
<label class="mdl-textfield__label" style="font-size: 1.25em;">your username</label>
<label class="mdl-textfield__label" style="font-size: 1.25em;">browse as</label>
<input type="text" name="loginas" class="mdl-textfield__input">
</div> <br />
--or--<br /><br /> <a href="https://hiveonboard.com?ref=blokz" target="hiveonboard">Create $HIVE Account</a>

@ -20,10 +20,10 @@ if (window.location.hash.length > 1) {
console.log("i found a post here: " + path2[1]);
routes = routes + "/" + path2[1];
history.pushState({ page: 1 }, "Some title", '?post=' + routes)
} else {
console.log("no post found, redirecting to ?hive=")
history.pushState({ page: 1 }, "Some title", '?hive=' + routes)
}
} else {
console.log("no post found, redirecting to ?hive=")
history.pushState({ page: 1 }, "Some title", '?hive=' + routes)
}
} else {
console.log("@ NOT Found ");
if (path2[1].charAt(0) == "@") {
@ -607,7 +607,7 @@ function createPost() {
);
// console.log(hiveuser + " connected");
} else {
// TODO : blokzlock private key
// broadcast a new post
console.log('c');
hive.broadcast.comment(
@ -1270,10 +1270,31 @@ function showtag(tag) {
});
}
function blokzlock() {
// close menu
// blokzmenu();
console.log('nope');
// create modal
// stor localstorage key
// use aes
var encrypted = AES256.encrypt('TEXT', 'PASSWORD');
console.log(encrypted);
// close dialog
// document.querySelector('dialog').close();
}
// MAIN()
window.onload = function loading() {
if (getQueryVariable("newpost") !== false) {
easyMDE = new EasyMDE({ element: document.getElementById('postBody'), minHeight: "55vh", maxHeight: "55vh" });
} else if (window.location.pathname == "/profile_update/") {
@ -1319,14 +1340,34 @@ window.onload = function loading() {
if (localStorage.getItem("hive") !== null) {
let loggedinas = localStorage.getItem("hive");
document.getElementById("loggedin").innerHTML = "<div style='float: right'><button class='mdl-button mdl-js-button' onclick='logout()'><i class='material-icons'>exit_to_app</i> Logout</button></div> <div style='padding-top: 3px;'><a href='../?hive=" + loggedinas + "' style='text-decoration: none'><button class='mdl-button mdl-js-button mdl-button--fab'><img src='https://images.hive.blog/u/" + loggedinas + "/avatar'></button> " + loggedinas + "</a></div> ";
document.getElementById("loggedin").innerHTML += "<br /><a href='../?newpost=true'>Write Post</a>";
}
if(localStorage.getItem("verified") == 'true') {
document.getElementById("loggedin").innerHTML = "<div style='float: right'><button class='mdl-button mdl-js-button' onclick='logout()'><i class='material-icons'>exit_to_app</i><small>Logout</small></button></div> <div style='padding-top: 3px;'><a href='../?hive=" + loggedinas + "' style='text-decoration: none'><button class='mdl-button mdl-js-button mdl-button--fab'><img src='https://images.hive.blog/u/" + loggedinas + "/avatar'></button> " + loggedinas + "</a><button class='mdl-button mdl-js-button' onclick='localStorage.removeItem(`verified`);location.reload()'><i class='material-icons'>verified_user</i><small style='color: green;'>verified</small></button></div> ";
document.getElementById("loggedin").innerHTML += "<br /><a href='../?newpost=true'>Write Post</a>";
if (update !== true && localStorage.getItem("hive") !== null) {
document.getElementById('showUpdate').innerHTML = "<a href='../profile_update/'>Update Profile</a>";
}
} else {
document.getElementById("loggedin").innerHTML = "<div style='float: right'><button class='mdl-button mdl-js-button' onclick='logout()'><i class='material-icons'>exit_to_app</i><small>Logout</small></button></div> <div style='padding-top: 3px;'><a href='../?hive=" + loggedinas + "' style='text-decoration: none'><button class='mdl-button mdl-js-button mdl-button--fab'><img src='https://images.hive.blog/u/" + loggedinas + "/avatar'></button> " + loggedinas + "</a><button class='mdl-button mdl-js-button' id='show-dialog' type='button' class='mdl-button'><i class='material-icons'>verified_user</i><small style='color: red;'>blokz lock</small></button></div> ";
// document.getElementById("loggedin").innerHTML += "<br /><a href='../?newpost=true'>Write Post</a>";
if (update !== true && localStorage.getItem("hive") !== null) {
document.getElementById('showUpdate').innerHTML = "<a href='../profile_update/'>Update Profile</a>";
var dialog = document.querySelector('dialog');
var showDialogButton = document.querySelector('#show-dialog');
if (! dialog.showModal) {
dialogPolyfill.registerDialog(dialog);
}
showDialogButton.addEventListener('click', function() {
dialog.showModal();
});
dialog.querySelector('.close').addEventListener('click', function() {
dialog.close();
});
/* Or dialog.show(); to show the dialog without a backdrop. */
}
}
if (tag !== "null") {
showtag(tag);
} else if (getQueryVariable("newpost") !== false) {
@ -1334,6 +1375,7 @@ window.onload = function loading() {
document.getElementById("newPostDiv").style.display = "block";
document.getElementById("display").style.display = "none";
document.getElementById("comments").style.display = "none";
document.getElementById("share").style.display = "none";
if (getQueryVariable("author") !== false) {
parentAuthor = getQueryVariable("author");
parentPermlink = getQueryVariable("permlink");

@ -144,7 +144,7 @@
<div id="loggedin">
<form id="frm2" action="/">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="font-size: 1.25em;">
<label class="mdl-textfield__label" style="font-size: 1.25em;">your username</label>
<label class="mdl-textfield__label" style="font-size: 1.25em;">browse as</label>
<input type="text" name="loginas" class="mdl-textfield__input">
</div> <br />
--or--<br /><br /> <a href="https://hiveonboard.com?ref=blokz" target="hiveonboard">Create $HIVE Account</a>

@ -20,10 +20,10 @@ if (window.location.hash.length > 1) {
console.log("i found a post here: " + path2[1]);
routes = routes + "/" + path2[1];
history.pushState({ page: 1 }, "Some title", '?post=' + routes)
} else {
console.log("no post found, redirecting to ?hive=")
history.pushState({ page: 1 }, "Some title", '?hive=' + routes)
}
} else {
console.log("no post found, redirecting to ?hive=")
history.pushState({ page: 1 }, "Some title", '?hive=' + routes)
}
} else {
console.log("@ NOT Found ");
if (path2[1].charAt(0) == "@") {
@ -607,7 +607,7 @@ function createPost() {
);
// console.log(hiveuser + " connected");
} else {
// TODO : blokzlock private key
// broadcast a new post
console.log('c');
hive.broadcast.comment(
@ -1270,10 +1270,31 @@ function showtag(tag) {
});
}
function blokzlock() {
// close menu
// blokzmenu();
console.log('nope');
// create modal
// stor localstorage key
// use aes
var encrypted = AES256.encrypt('TEXT', 'PASSWORD');
console.log(encrypted);
// close dialog
// document.querySelector('dialog').close();
}
// MAIN()
window.onload = function loading() {
if (getQueryVariable("newpost") !== false) {
easyMDE = new EasyMDE({ element: document.getElementById('postBody'), minHeight: "55vh", maxHeight: "55vh" });
} else if (window.location.pathname == "/profile_update/") {
@ -1319,14 +1340,34 @@ window.onload = function loading() {
if (localStorage.getItem("hive") !== null) {
let loggedinas = localStorage.getItem("hive");
document.getElementById("loggedin").innerHTML = "<div style='float: right'><button class='mdl-button mdl-js-button' onclick='logout()'><i class='material-icons'>exit_to_app</i> Logout</button></div> <div style='padding-top: 3px;'><a href='../?hive=" + loggedinas + "' style='text-decoration: none'><button class='mdl-button mdl-js-button mdl-button--fab'><img src='https://images.hive.blog/u/" + loggedinas + "/avatar'></button> " + loggedinas + "</a></div> ";
document.getElementById("loggedin").innerHTML += "<br /><a href='../?newpost=true'>Write Post</a>";
}
if(localStorage.getItem("verified") == 'true') {
document.getElementById("loggedin").innerHTML = "<div style='float: right'><button class='mdl-button mdl-js-button' onclick='logout()'><i class='material-icons'>exit_to_app</i><small>Logout</small></button></div> <div style='padding-top: 3px;'><a href='../?hive=" + loggedinas + "' style='text-decoration: none'><button class='mdl-button mdl-js-button mdl-button--fab'><img src='https://images.hive.blog/u/" + loggedinas + "/avatar'></button> " + loggedinas + "</a><button class='mdl-button mdl-js-button' onclick='localStorage.removeItem(`verified`);location.reload()'><i class='material-icons'>verified_user</i><small style='color: green;'>verified</small></button></div> ";
document.getElementById("loggedin").innerHTML += "<br /><a href='../?newpost=true'>Write Post</a>";
if (update !== true && localStorage.getItem("hive") !== null) {
document.getElementById('showUpdate').innerHTML = "<a href='../profile_update/'>Update Profile</a>";
}
} else {
document.getElementById("loggedin").innerHTML = "<div style='float: right'><button class='mdl-button mdl-js-button' onclick='logout()'><i class='material-icons'>exit_to_app</i><small>Logout</small></button></div> <div style='padding-top: 3px;'><a href='../?hive=" + loggedinas + "' style='text-decoration: none'><button class='mdl-button mdl-js-button mdl-button--fab'><img src='https://images.hive.blog/u/" + loggedinas + "/avatar'></button> " + loggedinas + "</a><button class='mdl-button mdl-js-button' id='show-dialog' type='button' class='mdl-button'><i class='material-icons'>verified_user</i><small style='color: red;'>blokz lock</small></button></div> ";
// document.getElementById("loggedin").innerHTML += "<br /><a href='../?newpost=true'>Write Post</a>";
if (update !== true && localStorage.getItem("hive") !== null) {
document.getElementById('showUpdate').innerHTML = "<a href='../profile_update/'>Update Profile</a>";
var dialog = document.querySelector('dialog');
var showDialogButton = document.querySelector('#show-dialog');
if (! dialog.showModal) {
dialogPolyfill.registerDialog(dialog);
}
showDialogButton.addEventListener('click', function() {
dialog.showModal();
});
dialog.querySelector('.close').addEventListener('click', function() {
dialog.close();
});
/* Or dialog.show(); to show the dialog without a backdrop. */
}
}
if (tag !== "null") {
showtag(tag);
} else if (getQueryVariable("newpost") !== false) {
@ -1334,6 +1375,7 @@ window.onload = function loading() {
document.getElementById("newPostDiv").style.display = "block";
document.getElementById("display").style.display = "none";
document.getElementById("comments").style.display = "none";
document.getElementById("share").style.display = "none";
if (getQueryVariable("author") !== false) {
parentAuthor = getQueryVariable("author");
parentPermlink = getQueryVariable("permlink");

@ -20,7 +20,7 @@
<script src="../js/mdl-chips-input.js" type="application/javascript"></script>
<div style="position: fixed; right: 20px; top: 20px"><small><i class='material-icons' onclick='share()' style='cursor: pointer;'>share</i></small></div>
<div style="position: fixed; right: 20px; top: 20px" id="share"><small><i class='material-icons' onclick='share()' style='cursor: pointer;'>share</i></small></div>
<div id="profile" style="padding-right: 1em; padding-left: 1em;"></div>
@ -150,4 +150,26 @@ data-upgraded=",MaterialButton,MaterialRipple">Submit</button></div>
</div>
</div>
</div>
<dialog class="mdl-dialog">
<h4 class="mdl-dialog__title">Verification</h4>
<div class="mdl-dialog__content">
<p>
Store your private posting key encrypted until you verify a session code.
</p>
<div class="verifiedusers"></div>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button" onclick='blokzlock();localStorage.setItem("verified", "true");location.reload()'>Add Key</button>
<button type="button" class="mdl-button close"><i class='material-icons'>close</i></button>
</div>
</dialog>

@ -23,7 +23,7 @@
<div id="loggedin">
<form id="frm2" action="/">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label" style="font-size: 1.25em;">
<label class="mdl-textfield__label" style="font-size: 1.25em;">your username</label>
<label class="mdl-textfield__label" style="font-size: 1.25em;">browse as</label>
<input type="text" name="loginas" class="mdl-textfield__input">
</div> <br />
--or--<br /><br /> <a href="https://hiveonboard.com?ref=blokz" target="hiveonboard">Create $HIVE Account</a>

Loading…
Cancel
Save