-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
163 lines (133 loc) · 6.57 KB
/
Copy pathindex.html
File metadata and controls
163 lines (133 loc) · 6.57 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Channel Point Filters URL Generator</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/css/fontawesome.min.css">
</head>
<style>
body.swal2-shown>[aria-hidden="true"] {
transition: 0.1s filter;
filter: blur(10px);
}
</style>
<body>
<div class="d-flex justify-content-center justify-content-center mt-5">
<form>
<div class="form-group">
<label for="twitchtoken">Twitch OAuth Token</label>
<input class="form-control" id="twitchtoken" placeholder="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
aria-describedby="getoauth" name="oauth">
<small id="getoauth" class="form-text text-muted"><a
href="https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=f3l7ldc6zwtdunaoe53rzms4icn0pl&redirect_uri=https://pentalex.github.io/ChannelPointFilters/&scope=channel:read:redemptions">Get
Token</a></small>
</div>
<div class="form-group">
<label for="obspw">WebSocket Password</label>
<input type="password" class="form-control" id="obspw" aria-describedby="pwHelp" name="pw">
<small id="pwHelp" class="form-text text-muted">Don't know what this is? Check out the guide <a
href="README.txt" target="_blank">here</a></small>
</div>
<div class="form-group">
<label for="obspw">Twitch Reward Name</label>
<input class="form-control" id="rewardname" name="rewardname" placeholder="Mic Filter">
<small id="sourceHelp" class="form-text text-muted">Exact name of the channel point reward that people
will use to enable filters.</small>
</div>
<div class="form-group">
<label for="obsmic">OBS Source Name</label>
<input class="form-control" id="sourcename" name="sourcename" placeholder="Mic/Aux">
<small id="sourceHelp" class="form-text text-muted">Name of your microphone in OBS. Can be found
in Audio Mixer.</small>
</div>
<div class="form-group">
<label for="time">Time per filter (in seconds)</label>
<input type="number" min="1" max="10000" class="form-control" id="time" name="time" placeholder="15">
</div>
<div class="form-group">
<label for="time">Amount of filters</label>
<input type="number" min="1" max="10000" class="form-control" id="filteramount" name="filteramount"
placeholder="3">
</div>
<button type="button" id="generate" class="btn btn-primary">Generate URL</button>
<hr>
</form>
</div>
<div class="d-flex justify-content-center justify-content-center mt-5">
<div class="input-group mt-5 col-7" id="generatedBox">
<input type="text" min="1" max="10000" class="form-control" id="generated" name="generated"
placeholder="Please hit generate URL" readonly>
<span class="input-group-btn ml-2">
<button type="button" id="copy" class="btn btn-primary">Copy</button>
</span>
</div>
</div>
<!-- TODO: Here goes your content! -->
<!-- Including Bootstrap JS (with its jQuery dependency) so that dynamic components work -->
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
</script>
<script>
var hash = window.location.hash;
const button = document.getElementById("generate");
const copybutton = document.getElementById("copy");
copybutton.onclick = function () {
navigator.clipboard.writeText(document.getElementById("generated").value).then(() => {
console.log('Content copied to clipboard');
copybutton.innerHTML = "Copied!"
}, () => {
console.error('Failed to copy');
/* Rejected - text failed to copy to the clipboard */
});
}
if (hash) {
var oauthbox = document.getElementById("twitchtoken");
oauthbox.value = hash.substring(14, 44);
oauthbox.readOnly = true;
} else {
Swal.fire({
title: 'Streamer Warning!',
text: 'DO NOT DO THIS SETUP ON STREAM. YOU WILL LEAK.',
icon: 'warning',
confirmButtonText: 'Understood.'
})
}
button.onclick = function () {
const token = document.getElementById("twitchtoken").value;
const obspw = document.getElementById("obspw").value;
var rewardname = document.getElementById("rewardname").value;
var sourcename = document.getElementById("sourcename").value;
var time = document.getElementById("time").value;
var filteramount = document.getElementById("filteramount").value;
if (rewardname.length == 0) {
rewardname = "Mic Filter";
}
if (sourcename.length == 0) {
sourcename = "Mic/Aux";
}
if (time.length == 0) {
time = 15;
}
if (filteramount.length == 0) {
filteramount = 3;
}
var url = new URL(window.location.protocol + window.location.host + '/ChannelPointFilters/app.html');
url.searchParams.append('token', token);
url.searchParams.append('obspw', obspw);
url.searchParams.append('rewardname', rewardname);
url.searchParams.append('sourcename', sourcename);
url.searchParams.append('time', time);
url.searchParams.append('filteramount', filteramount);
document.getElementById("generated").value = url;
document.getElementById("generatedBox").style.visibility = "visible";
console.log(url);
}
</script>
</body>
</html>