Skip to content

Commit

Permalink
removed global dateNow, now explictly called in each js
Browse files Browse the repository at this point in the history
  • Loading branch information
avlo committed Nov 10, 2024
1 parent 7b5a56c commit 22caea7
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/main/resources/static/js/common.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
let ws
let dateNow

function connect() {
ws = new WebSocket('wss://localhost:5555');
ws.onmessage = function (messageEvent) {
showEvent(messageEvent.data);
}
setConnected(true);
dateNow = Math.floor(Date.now() / 1000);
console.log("date [" + dateNow + "]");
}

function setConnected(connected) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/nip-01.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function generate01TypeScriptEvent() {
let event = {
id: '',
kind: Number($("#01-kind").val()),
created_at: dateNow,
created_at: Math.floor(Date.now() / 1000),
content: $("#01-content").val(),
tags: tags,
pubkey: '',
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/nip-57.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function generate57TypeScriptEvent() {
let event = {
id: '',
kind: Number($("#57-kind").val()),
created_at: dateNow,
created_at: Math.floor(Date.now() / 1000),
content: $("#57-content").val(),
tags: tags,
pubkey: '',
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/static/js/nip-99.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $(function () {
});

function generate99TypeScriptEvent() {
const dateNow = Math.floor(Date.now() / 1000);
const tags = [
['subject', $("#99-subject").val()],
['title', $("#title").val()],
Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/static/js/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function replaceHashRegister(id_hash) {
{
'id': id_hash,
'pubkey': $("#pubkeyregister").val(),
'created_at': Date.now(),
'created_at': Math.floor(Date.now() / 1000),
'kind': 22242,
'tags': [
['relay', $("#relay").val()],
Expand All @@ -42,10 +42,9 @@ function replaceHashRegister(id_hash) {

function sendContentRegister(id_hash) {
console.log("\nsending content...\n\n");
console.log("sending w/ date now: " + dateNow);
currentSubscriptonId = id_hash;
let localjsonstring = replaceHashRegister(id_hash);
console.log(localjsonstring);
console.log('\n\n');
ws.send(localjsonstring);
}
}
1 change: 0 additions & 1 deletion src/main/resources/static/js/req.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function populateRequestJson() {

function sendContentRequest() {
console.log("\nsending content...\n\n");
console.log("sending w/ date now: " + dateNow);
let outboundJson = populateRequestJson();
console.log(outboundJson);
console.log('\n\n');
Expand Down

0 comments on commit 22caea7

Please sign in to comment.