diff --git a/.gitignore b/.gitignore
index 2261d82..9b08644 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ _config.yml
*tar.gz
.idea/
_site/
+.jekyll-cache
diff --git a/_config.example.yml b/_config.example.yml
index e06e2a7..b01c675 100644
--- a/_config.example.yml
+++ b/_config.example.yml
@@ -11,13 +11,11 @@ exclude:
title: "Secret Share"
description: "A site for sharing secrets"
secret_endpoint: https://xxxxx.execute-api.us-east-1.amazonaws.com/live/secret/
+url: http://localhost:4000
baseurl: /secret # no trailing or only slash
background: images/bg03.jpg # without baseurl
-
-# Copyright info
-copyright_text: "Company Name"
-copyright_url: "Company Site"
-license_path: LICENSE.txt # without baseurl
+homesite_name: LZAHQ
+homesite_url: https://lzahq.tech
# Social Media - can remove to not show icons
social:
diff --git a/_includes/footer.html b/_includes/footer.html
index 98aeed2..b6dcd83 100644
--- a/_includes/footer.html
+++ b/_includes/footer.html
@@ -5,8 +5,8 @@
{% endfor %}
diff --git a/_includes/header.html b/_includes/header.html
index 4239808..6e8c5c1 100644
--- a/_includes/header.html
+++ b/_includes/header.html
@@ -1,4 +1,4 @@
diff --git a/assets/js/main.js b/assets/js/main.js
index 9f18de1..9d16490 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -3,8 +3,27 @@
---
+function getQueryStrings() {
+ var vars = [], hash;
+ var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
+ for(var i = 0; i < hashes.length; i++)
+ {
+ hash = hashes[i].split('=');
+ vars.push(hash[0]);
+ vars[hash[0]] = hash[1];
+ }
+ return vars;
+}
+
$( document ).ready(function(){
$('body').removeClass('is-preload');
+
+ // Check if query strings were passed to automatically show the secret
+ let token = getQueryStrings()['token'];
+ if ( token ) {
+ showSecret(token);
+ $('#retrieve-secret').hide();
+ }
});
$('#create-secret').on('submit', function(event) {
@@ -27,8 +46,9 @@ $('#create-secret').on('submit', function(event) {
contentType: 'application/json',
data: JSON.stringify(data),
success: function (res){
+ let url = '{{ site.url }}{{ site.baseurl }}/retrieve?token=' + res['token']
$('#create-secret').trigger('reset');
- $('#secret-response').html('Secret token: ' + res['token']);
+ $('#secret-response').html('' + url + '');
$('#secret-response').removeClass('hidden');
},
error: function (res){
@@ -39,30 +59,34 @@ $('#create-secret').on('submit', function(event) {
}, 750);
});
+
+function showSecret(token) {
+ $.ajax({
+ method: 'GET',
+ url: '{{ site.secret_endpoint }}?token=' + token,
+ crossDomain: 'true',
+ contentType: 'application/json',
+ success: function (res){
+ $('#retrieve-secret').trigger('reset');
+ $('#secret-response').removeClass('hidden');
+ $('#response-username').html(res['username']);
+ $('#response-password').html(res['password']);
+ $('#response-message').html(res['message']);
+ $('#response-expiration').html(res['expiration']);
+ },
+ error: function (res){
+ $('#secret-response').html('Something went wrong: ' + JSON.stringify(res.responseJSON));
+ $('#secret-response').removeClass('hidden');
+ }
+ })
+}
+
+
$('#retrieve-secret').on('submit', function(event) {
event.stopPropagation();
event.preventDefault();
window.setTimeout(function() {
-
- var token = $('#secret-token').val();
-
- $.ajax({
- method: 'GET',
- url: '{{ site.secret_endpoint }}?token=' + token,
- crossDomain: 'true',
- contentType: 'application/json',
- success: function (res){
- $('#retrieve-secret').trigger('reset');
- $('#secret-response').removeClass('hidden');
- $('#response-username').html(res['username']);
- $('#response-password').html(res['password']);
- $('#response-message').html(res['message']);
- $('#response-expiration').html(res['expiration']);
- },
- error: function (res){
- $('#secret-response').html('Something went wrong: ' + JSON.stringify(res.responseJSON));
- $('#secret-response').removeClass('hidden');
- }
- })
+ var token = $('#secret-token').val();
+ showSecret(token);
}, 750);
});