-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
93 lines (86 loc) · 2.99 KB
/
index.html
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
<html>
<head>
<title>Set Telegram Webhooks</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.0/css/bulma.min.css" />
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div class="container">
<div id="app" class="section">
<form :action="set_webhook" method="post" enctype="multipart/form-data">
<label class="label">Enter your Token</label>
<p class="control">
<input class="input" type="text" v-model="token" />
</p>
<label class="label">Enter your Host</label>
<p class="control">
<input class="radio" type="radio" name="protocol" v-model="protocol" value='https'> https
<input class="radio" type="radio" name="protocol" v-model="protocol" value='http'> http
<input class="input" type="text" v-model="host" />
</p>
<label class="label">Enter your Port</label>
<p class="control">
<input class="input" type="text" v-model="port" />
</p>
<label class="label">Enter URL path</label>
<p class="control">
<input class="input" type="text" v-model="path" />
</p>
<input type="hidden" name="url" v-model="bot_url">
<label class="label">Maximum Connections?</label>
<p class="control">
<input class="input" type="text" name="max_connections" value="100" />
</p>
<br/>
<p style="color:blue">{{ bot_url }}</p>
<br/>
<label class="label">Enter your Certificate</label>
<p class="control">
<input type="file" name="certificate" id="fileToUpload" />
</p>
<br/>
<div class="control is-grouped">
<p class="control">
<button class="button is-primary" name="submit">Set Webhook</button>
</p>
<br/>
<p class="control">
<a :href="get_webhook_info" target="_blank" class="button is-info">Get Webhook Info</a>
</p>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data: {
token: '12345678:ABCdefgHIjKLmNOPQrstu_vwXYZ12345678',
port: 1080,
host: 'your-server.com',
path: 'webhooks/bot',
protocol: 'https',
},
computed: {
get_webhook_info: function () {
return 'https://api.telegram.org/bot' + this.token + '/getwebhookinfo'
},
set_webhook: function () {
return 'https://api.telegram.org/bot' + this.token + '/setwebhook'
},
bot_url: function () {
port_string = '';
if (this.port) {
port_string = ':' + this.port;
}
path_string = '/' + this.path;
return this.protocol + '://' + this.host
+ port_string
+ path_string + this.token
}
}
}
)
</script>
</body>
</html>