Przeglądaj źródła

No more asking token on front if private

Pitu 7 lat temu
rodzic
commit
1ec6bbb640
2 zmienionych plików z 3 dodań i 14 usunięć
  1. 1 6
      pages/home.html
  2. 2 8
      public/js/upload.js

+ 1 - 6
pages/home.html

@@ -25,12 +25,7 @@
                     <div class="columns">
                         <div class="column is-hidden-mobile"></div>
                         <div class="column" id='uploadContainer'>
-
-                            <p id='tokenContainer' class="control has-addons has-addons-centered">
-                                <input id='token' class="input is-danger" type="text" placeholder="Your token">
-                                <a id='tokenSubmit' class="button is-danger">Check</a>
-                            </p>
-
+                            <a id="loginToUpload" href="/auth" class="button is-danger">Running in private mode. Log in to upload.</a>
                         </div>
                         <div class="column is-hidden-mobile"></div>
                     </div>

+ 2 - 8
public/js/upload.js

@@ -21,13 +21,7 @@ upload.checkIfPublic = function(){
 
 upload.preparePage = function(){
 	if(!upload.isPrivate) return upload.prepareUpload();
-	if(!upload.token){
-		document.getElementById('tokenSubmit').addEventListener('click', function(){
-			upload.verifyToken(document.getElementById('token').value)
-		});
-		document.getElementById('tokenContainer').style.display = 'flex';
-		return;
-	}
+	if(!upload.token) return document.getElementById('loginToUpload').style.display = 'inline-flex';
 	upload.verifyToken(upload.token, true);
 }
 
@@ -74,7 +68,7 @@ upload.prepareUpload = function(){
 	div.style.display = 'flex';
 
 	document.getElementById('maxFileSize').innerHTML = 'Maximum upload size per file is ' + upload.maxFileSize;
-	document.getElementById('tokenContainer').style.display = 'none';
+	document.getElementById('loginToUpload').style.display = 'none';
 	document.getElementById('uploadContainer').appendChild(div);
 
 	upload.prepareDropzone();