Skip to content

Commit

Permalink
onload and improved UI
Browse files Browse the repository at this point in the history
  • Loading branch information
SomajitDey committed Sep 20, 2024
1 parent fb0b829 commit 3a9b612
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions app/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Main entry point for the server. Deploys background worker in "bg-worker.js" for handling networking.

spaHide("jsAlert");

let myWorker = null;
let numReadMsgs = 0;
let numTotalMsgs = 0;
Expand Down Expand Up @@ -98,6 +96,7 @@ function config() {
localStorage.setItem("getFrom", getFrom);
const postTo = 'https://api.telegram.org/bot' + document.getElementById("TGbotKey").value + '/sendMessage';
localStorage.setItem("postTo", postTo);
spaHide("login");
spaGoTo("server");
localStorage.setItem("loggedIn", "true");
}
Expand Down Expand Up @@ -175,12 +174,11 @@ function signout() {
function main() {
// Enable config if no prior settings found in localStorage
if (localStorage.getItem("loggedIn")) {
spaHide("login");
startWorker();
spaGoTo("server");
} else {
spaGoTo("setup");
}

}

spaHide("jsAlert");
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="themes/prism.css">
</head>
<body>
<body onload="spaHide('jsAlert');">
<div class="container-fluid p-5 text-bg-primary text-center">
<h1>Welcome to EasyForm</h1>
</div>
Expand Down Expand Up @@ -64,8 +64,6 @@ <h3>About</h3>
You will also be notified via Telegram.
</p>

<p><button class="btn btn-primary mt-4" onclick="main();">Let's get started</button></p>

<h3>Powered by</h3>
<ul class="nav nav-pills nav-justified">
<li class="nav-item"><a class="nav-link" href="https://github.com/nwtgck/piping-server">piping-server</a></li>
Expand All @@ -79,6 +77,8 @@ <h3>Powered by</h3>
</ul>
</section>
</div>
<p class="d-flex justify-content-start"><button class="btn btn-danger mt-4" onclick="main();" id="login">Let's get started</button></p>

<div class="spa-page" id="setup">
<section>
<h3>Setup</h3>
Expand All @@ -89,7 +89,7 @@ <h3>Setup</h3>
<br>
<p>2. Send any text to the Bot. Then, click Fetch Chat ID. Do not enter your chat ID by hand.</p>
<button onclick="fetchChatID();">Fetch Chat ID</button>
<input type="text" id="chatID" placeholder="Chat ID" required>
<input type="text" id="chatID" placeholder="Chat ID" disabled required>
<br><br>
<p>3. Generate or enter your EasyForm API Key:</p>
<button onclick="genUUID();">Generate API Key</button>
Expand Down

0 comments on commit 3a9b612

Please sign in to comment.