-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
136 lines (119 loc) · 5.73 KB
/
Copy pathindex.html
File metadata and controls
136 lines (119 loc) · 5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Pushcut Web Post Request</title>
</head>
<body class="bg-light">
<div class="container">
<div class="row">
<div class="offset-md-3 col-md-6">
<div class="card mt-5 shadow-sm">
<div class="card-body">
<div class="d-flex">
<h5 class="card-title mb-0 mr-auto" id="title"></h5>
<a href="" style="line-height: inherit" class="badge badge-pill badge-light stretched-link" data-toggle="modal" data-target="#configure">Configure</a>
</div>
<p class="card-text mb-0" id="text"></p>
<p class="card-text mb-0" style="word-break: break-all" data-toggle="modal" data-target="#configure"><small class="text-muted" id="parameter"></small></p>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="configure">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Configure Tool</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="">
<div class="form-group">
<label for="" class="form-label">Secret</label>
<input id="ask-secret" type="text" class="form-control text-danger">
<small class="form-text text-muted">
Pushcut Webhook Secret
</small>
</div>
<div class="form-group">
<label for="" class="form-label">Notification Name</label>
<input id="ask-notification-name" type="text" class="form-control">
<small class="form-text text-muted">
Pushcut Notification Name
</small>
</div>
<div class="form-group">
<label for="" class="form-label">Notification Title</label>
<input id="ask-title" type="text" class="form-control">
</div>
<div class="form-group">
<label for="" class="form-label">Notification Text</label>
<textarea id="ask-text" class="form-control" name="" rows="3"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script>
function get() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
vars[key] = value;
});
return vars;
}
var secret = get()["secret"];
var noname = get()["noname"];
var title = get()["title"];
var text = get()["text"];
var parameter = '?secret=' + secret + '&noname=' + noname + '&title=' + title + '&text=' + text
function urldecode(str) {
return decodeURIComponent((str + ' ').replace(/\+/g, '%20'));
}
title = urldecode(title)
text = urldecode(text)
noname = urldecode(noname)
$('#title').html(title)
$('#text').html(text)
$('#parameter').html(parameter)
$.post('https://api.pushcut.io/' + secret + '/notifications/' + noname, {
title: title,
text: text
});
/* Fill Config Form */
$('#ask-secret').val(secret)
$('#ask-notification-name').val(noname)
$('#ask-title').val(title)
$('#ask-text').val(text)
$("form").change(function() {
secret = $('#ask-secret').val()
noname = $('#ask-notification-name').val()
title = $('#ask-title').val()
text = $('#ask-text').val()
})
$(".btn-primary").click(function() {
window.location.replace('?secret=' + secret + '&noname=' + noname + '&title=' + title + '&text=' + text)
})
/* %0D%0A */
</script>
</body>
</html>