Skip to content

Commit

Permalink
Update readme and added some validations
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mer committed Jan 24, 2022
1 parent cc3e453 commit 673c3cd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ With SafeUrl, you can get the following information:
* [IpInfo](https://ipinfo.io/) free API is limited to 50,000 calls/moneh.

## Usage
In order to start working with SafeUrl, you need to register for free [VirusTotal)] (https://www.virustotal.com/gui/home/url) account and get a valid Free API Key.
[![SafeUrl Index Page](https://raw.githubusercontent.com/t0mer/SafeUrl/main/Images/SafeUrl%20-%20VirusTotal%20API.PNG?raw=true)](https://raw.githubusercontent.com/t0mer/SafeUrl/main/Images/SafeUrl%20-%20VirusTotal%20API.PNG?raw=true)

Now, add the VirusTotal API key to the docker environment and you are ready to go.

### Run from hub

#### docker-compose from hub
Expand Down
2 changes: 1 addition & 1 deletion app/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.0
2.2.0
5 changes: 3 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ def ipinfo(request: Request, url : str =""):

@app.get("/")
def home(request: Request):
logger.info("Loadin default page")
return templates.TemplateResponse('index.html', context={'request': request,'version':GetVersionFromFle()})
vtotal_enabled = VT_API_KEY != ""
logger.info("Loading default page")
return templates.TemplateResponse('index.html', context={'request': request,'version':GetVersionFromFle(), 'vtotal_enabled':vtotal_enabled })


if __name__ == '__main__':
Expand Down
10 changes: 9 additions & 1 deletion app/dist/css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -6591,4 +6591,12 @@ h1 {
Ok so you have made it this far, that means you are very keen to on my code.
Anyway I don't really mind it. This is a great way to learn so you actually doing the right thing:)
Follow me @ihatetomatoes
*/
*/


#vtwarning
{
width:80%;
margin: 0 auto 10px;
display: none;
}
3 changes: 0 additions & 3 deletions app/dist/js/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
$(document).ready(function() {





$("ul.nav-tabs a").click(function(e) {
e.preventDefault();
$(this).tab('show');
Expand Down
20 changes: 19 additions & 1 deletion app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
<!-- <link rel="stylesheet" href="dist/css/all.min.css"> -->
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css">
<link rel="stylesheet" href="dist/css/all.css">
<style>
.login-box, .register-box {
width: 700px;
}
</style>


</head>
<body class="hold-transition login-page">
<div class="login-box">
Expand All @@ -33,14 +35,19 @@
</div>
</div>
</div>
<button type="submit" class="btn btn-primary btn-block">Check URL</button>
<button type="submit" id='checkbtn' class="btn btn-primary btn-block">Check URL</button>
</div>
<!-- /.col -->
<span id='vtwarning' class='warning'>VirusTotal API key is missing from environment, please supply a valid one.</span>
</div>

</form>

</div>
<!-- /.login-card-body -->

</div>

</div>
<!-- /.login-box -->

Expand All @@ -50,5 +57,16 @@
<script src="dist/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<!-- <script src="dist/js/adminlte.min.js"></script> -->
<script>
vtotal_enabled = '{{ vtotal_enabled }}';
$(document).ready(function() {
if(vtotal_enabled=='False')
{
$('#vtwarning').show();
$('#checkbtn').prop('disabled','disabled');
}
});
</script>

</body>
</html>

0 comments on commit 673c3cd

Please sign in to comment.