posiflow-telegram-connector 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +795 -0
- package/models/Setting.js +32 -0
- package/package.json +32 -0
- package/publish.sh +22 -0
- package/template/configure.html +349 -0
- package/template/css/configure.css +477 -0
- package/template/css/detail.css +186 -0
- package/template/css/error.css +67 -0
- package/template/css/style.css +93 -0
- package/template/detail.html +278 -0
- package/template/error.html +65 -0
- package/template/img/arrow-right.png +0 -0
- package/template/img/check.png +0 -0
- package/template/img/telegram-header.png +0 -0
- package/test/test_translate_telegram.js +464 -0
- package/tiledesk/KVBaseMongo.js +104 -0
- package/tiledesk/MessageHandler.js +31 -0
- package/tiledesk/TiledeskAppsClient.js +163 -0
- package/tiledesk/TiledeskChannel.js +175 -0
- package/tiledesk/TiledeskSubscriptionClient.js +138 -0
- package/tiledesk/TiledeskTelegram.js +304 -0
- package/tiledesk/TiledeskTelegramTranslator.js +300 -0
- package/winston.js +41 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const SettingSchema = mongoose.Schema({
|
|
4
|
+
projectId: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true
|
|
7
|
+
},
|
|
8
|
+
token: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
subscriptionId: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
secret: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
botName: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
tgToken: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
collection: 'settings'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
module.exports = mongoose.model('Setting', SettingSchema);
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "posiflow-telegram-connector",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Tiledesk Telegram Connector with Reply Keyboard support - Fork for Posiflow",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "mocha",
|
|
8
|
+
"start": "node index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "Giovanni Troisi",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@tiledesk/tiledesk-client": "^0.8.29",
|
|
15
|
+
"app-root-path": "^3.0.0",
|
|
16
|
+
"axios": "^0.27.2",
|
|
17
|
+
"body-parser": "^1.20.0",
|
|
18
|
+
"dotenv": "^16.0.2",
|
|
19
|
+
"express": "^4.18.1",
|
|
20
|
+
"form-data": "^4.0.0",
|
|
21
|
+
"handlebars": "^4.7.7",
|
|
22
|
+
"jsonwebtoken": "^8.5.1",
|
|
23
|
+
"mongoose": "^6.5.0",
|
|
24
|
+
"mongodb": "^3.5.5",
|
|
25
|
+
"multer": "^1.4.5-lts.1",
|
|
26
|
+
"uuid": "^8.3.2",
|
|
27
|
+
"winston": "^3.3.3"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"mocha": "^8.2.1"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/publish.sh
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#npm version patch
|
|
2
|
+
version=`node -e 'console.log(require("./package.json").version)'`
|
|
3
|
+
echo "version $version"
|
|
4
|
+
|
|
5
|
+
## Update package-lock.json
|
|
6
|
+
npm install
|
|
7
|
+
|
|
8
|
+
git add .
|
|
9
|
+
git commit -m "version added: ### $version"
|
|
10
|
+
git push remote main
|
|
11
|
+
|
|
12
|
+
if [ "$version" != "" ]; then
|
|
13
|
+
git tag -a "$version" -m "`git log -1 --format=%s`"
|
|
14
|
+
echo "Created a new tag, $version"
|
|
15
|
+
git push --tags
|
|
16
|
+
npm publish --access public
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
echo "***************************************************************************"
|
|
20
|
+
echo " Tagged: tiledesk/tiledesk-telegram-connector:$version"
|
|
21
|
+
echo "***************************************************************************"
|
|
22
|
+
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
|
|
9
|
+
<!-- Bootstrap 5.3 CSS -->
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
|
11
|
+
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
|
12
|
+
crossorigin="anonymous">
|
|
13
|
+
|
|
14
|
+
<!-- Font Awesome 7 (latest version) -->
|
|
15
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" crossorigin="anonymous" />
|
|
16
|
+
|
|
17
|
+
<!-- Font Poppins -->
|
|
18
|
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet" />
|
|
19
|
+
|
|
20
|
+
<!-- Custom CSS -->
|
|
21
|
+
<link rel="stylesheet" href="./css/configure.css">
|
|
22
|
+
|
|
23
|
+
<!-- Bootstrap 5.3 JavaScript Bundle (include Popper) -->
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
|
25
|
+
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
|
26
|
+
crossorigin="anonymous">
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<body>
|
|
33
|
+
|
|
34
|
+
<!-- Success modal -->
|
|
35
|
+
{{#if show_success_modal}}
|
|
36
|
+
<div id="success-update-modal" class="success-modal">
|
|
37
|
+
<div class="modal-content">
|
|
38
|
+
<img src="https://cdn3.iconfinder.com/data/icons/social-media-chamfered-corner/154/telegram-512.png" width="80" height="auto" style="border-radius: 17px;" />
|
|
39
|
+
<p class="modal-text" style="margin-top: 20px; margin-bottom: 20px;">Configuration updated successfully</p>
|
|
40
|
+
<button class="btn cancel-btn" onclick="document.getElementById('success-update-modal').style.display='none'">Close</button>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
{{/if}}
|
|
44
|
+
|
|
45
|
+
<!-- Error modal -->
|
|
46
|
+
{{#if show_error_modal}}
|
|
47
|
+
<div id="error-update-modal" class="error-modal">
|
|
48
|
+
<div class="modal-content">
|
|
49
|
+
<img src="https://cdn-icons-png.flaticon.com/512/148/148766.png" width="80" height="auto" />
|
|
50
|
+
<p style="margin-top: 20px; margin-bottom: 20px;">An error occurred while updating the configuration</p>
|
|
51
|
+
<button class="btn cancel-btn" onclick="document.getElementById('error-update-modal').style.display='none'">Close</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
{{/if}}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<!-- HEADER -->
|
|
59
|
+
<div class="header">
|
|
60
|
+
<div class="header-content">
|
|
61
|
+
<div class="logo-title">
|
|
62
|
+
<div class="logo-container">
|
|
63
|
+
<img src="https://user-images.githubusercontent.com/45603238/197573811-3bea5d88-9795-4dea-a553-3d18ed02d4b0.png" width="60px" height="60px">
|
|
64
|
+
</div>
|
|
65
|
+
<div class="title-version">
|
|
66
|
+
<p class="title">Telegram Connector</p>
|
|
67
|
+
<div class="status-box" style="padding: 0px 8px; letter-spacing: 1px; height: 18px;">
|
|
68
|
+
<p style="margin-bottom: 0px;">{{ app_version }}</p>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="status-box">
|
|
73
|
+
<p style="margin-bottom: 0px; margin-right: 8px;">Status: </p>
|
|
74
|
+
{{#if telegram_token}}
|
|
75
|
+
<i class="fa fa-circle green-circle"></i>
|
|
76
|
+
<p style="margin-bottom: 0px;">Connected</p>
|
|
77
|
+
{{else}}
|
|
78
|
+
<i class="fa fa-circle red-circle"></i>
|
|
79
|
+
<p style="margin-bottom: 0px;">Disconnected</p>
|
|
80
|
+
{{/if}}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
<!-- INFO BOX -->
|
|
87
|
+
<div class="info-box">
|
|
88
|
+
{{brand_name}}
|
|
89
|
+
{{#unless brand_name}}
|
|
90
|
+
<div class="info-list">
|
|
91
|
+
<ul>
|
|
92
|
+
<div class="list-element">
|
|
93
|
+
<img src="./img/check.png" width="20" height="20" style="margin-right: 10px;"/>
|
|
94
|
+
<h7>Integrate Telegram bot with Tiledesk.</h7>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="list-element">
|
|
97
|
+
<img src="./img/check.png" width="20" height="20" style="margin-right: 10px;"/>
|
|
98
|
+
<h7>Once a chat is initiated on Telegram bot, receive an alert on your Tiledesk account.</h7>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="list-element">
|
|
101
|
+
<img src="./img/check.png" width="20" height="20" style="margin-right: 10px;"/>
|
|
102
|
+
<h7>Enable instant messaging and answer multiple conversations, everything from Tiledesk account.</h7>
|
|
103
|
+
</div>
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
{{/unless}}
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Docs Section -->
|
|
110
|
+
<div class="docs-box">
|
|
111
|
+
{{#unless brand_name}}
|
|
112
|
+
<div class="docs-section">
|
|
113
|
+
<p style="margin-top: 20px; font-size: 18px; font-weight: 600;">Before you start</p>
|
|
114
|
+
<div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
|
|
115
|
+
<div style="display: flex; flex-direction: row; align-items: baseline;">
|
|
116
|
+
<div>
|
|
117
|
+
<img src="https://cdn-icons-png.freepik.com/256/13077/13077927.png?semt=ais_hybrid" width="20px" height="auto" style="margin-right: 10px;">
|
|
118
|
+
</div>
|
|
119
|
+
<div>
|
|
120
|
+
<a href="https://gethelp.tiledesk.com/articles/telegram/" target="_blank">Connect Tiledesk with Telegram bot</a>
|
|
121
|
+
<p style="color: grey; margin-bottom: 0px;">A small but very useful guide on how to connect your Telegram bot with Tiledesk</p>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
{{/unless}}
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<!-- CONFIGURE BOX -->
|
|
131
|
+
<div class="configure-box">
|
|
132
|
+
<div class="configure">
|
|
133
|
+
<p class="title" style="margin-bottom: 20px;">Your Configuration</p>
|
|
134
|
+
|
|
135
|
+
<div style="min-width: 600px">
|
|
136
|
+
<form action="./update" method="post">
|
|
137
|
+
|
|
138
|
+
<!-- Bot name -->
|
|
139
|
+
<div class="form-group" style="width: 522px;">
|
|
140
|
+
<label class="input-label" for="bot_name">Bot Name</label>
|
|
141
|
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
|
142
|
+
<input type="text" class="form-control custom-input" name="bot_name" value="{{ bot_name }}" placeholder="Enter Bot Name">
|
|
143
|
+
<span style="margin-left: 10px;">
|
|
144
|
+
<i class="fa fa-question-circle custom-tooltip">
|
|
145
|
+
<span class="custom-tooltiptext">This is the name of your Telegram bot</span>
|
|
146
|
+
</i>
|
|
147
|
+
</span>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<!-- Verify Token -->
|
|
152
|
+
<div class="form-group" style="width: 522px;">
|
|
153
|
+
<label class="input-label" for="telegram_token">Telegram Token</label>
|
|
154
|
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
|
155
|
+
<input type="text" required class="form-control custom-input" name="telegram_token" value="{{ telegram_token }}" placeholder="Enter your bot authentication token">
|
|
156
|
+
<span style="margin-left: 10px;">
|
|
157
|
+
<i class="fa fa-question-circle custom-tooltip">
|
|
158
|
+
<span class="custom-tooltiptext">The Telegram token provided by @BotFather</span>
|
|
159
|
+
</i>
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<!-- Departments -->
|
|
165
|
+
<div class="form-group" style="width: 522px;">
|
|
166
|
+
<label class="input-label" for="department">Department <span style="font-weight: normal;">(Optional)</span></label>
|
|
167
|
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
|
168
|
+
<select class="custom-select form-control" name="department" placeholder="default">
|
|
169
|
+
{{#each departments}}
|
|
170
|
+
{{#if (isEqual _id ../department_id)}}
|
|
171
|
+
<option value="{{ _id }}" selected>{{ name }}</option>
|
|
172
|
+
{{else}}
|
|
173
|
+
<option value="{{ _id }}">{{ name }}</option>
|
|
174
|
+
{{/if}}
|
|
175
|
+
{{/each}}
|
|
176
|
+
</select>
|
|
177
|
+
<span style="margin-left: 10px;">
|
|
178
|
+
<i class="fa fa-question-circle custom-tooltip">
|
|
179
|
+
<span class="custom-tooltiptext">Select the department where you want to open conversations coming from Telegram. Conversations are sent on the Default Department by default.</span>
|
|
180
|
+
</i>
|
|
181
|
+
</span>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<input type="hidden" name="project_id" value="{{ project_id }}" />
|
|
186
|
+
<input type="hidden" name="token" value="{{ token }}" />
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
{{#if telegram_token}}
|
|
190
|
+
<div style="width: 500px; text-align: right;">
|
|
191
|
+
<input type="submit" class="btn" style="width: 200px; background-color: #0ba2dc; color: white; font-weight: 500;" value="Update">
|
|
192
|
+
</div>
|
|
193
|
+
{{else}}
|
|
194
|
+
<div style="width: 500px; text-align: right;">
|
|
195
|
+
<input type="submit" class="btn" style="width: 200px; background-color: #0ba2dc; color: white; font-weight: 500;" value="Connect">
|
|
196
|
+
</div>
|
|
197
|
+
{{/if}}
|
|
198
|
+
</form>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
{{#if telegram_token}}
|
|
207
|
+
<div class="advanced-box">
|
|
208
|
+
<div class="advanced">
|
|
209
|
+
|
|
210
|
+
<p class="title" style="margin-bottom: 20px;">Advanced</p>
|
|
211
|
+
|
|
212
|
+
<form action="./update_advanced" id="advanced_form" method="post">
|
|
213
|
+
<div class="item">
|
|
214
|
+
<div class="toggle-pill-dark" style="display: flex; flex-direction: row; height: 26px;">
|
|
215
|
+
<div style="margin-right: 10px">
|
|
216
|
+
{{#if show_info_message}}
|
|
217
|
+
<input type="checkbox" id="show_info_message" name="show_info_message" checked onclick="update_advanced()">
|
|
218
|
+
{{else}}
|
|
219
|
+
<input type="checkbox" id="show_info_message" name="show_info_message" onclick="update_advanced()">
|
|
220
|
+
{{/if}}
|
|
221
|
+
<label for="show_info_message"></label>
|
|
222
|
+
<input type="hidden" name="project_id" value="{{ project_id }}" />
|
|
223
|
+
<!--<input type="hidden" name="token" value="{{ token }}" />-->
|
|
224
|
+
<input type="submit" style="display: none">
|
|
225
|
+
</div>
|
|
226
|
+
<p>Show info message</p>
|
|
227
|
+
</div>
|
|
228
|
+
<p class="option-description">Choose whether to send info messages on the visitor's chat. </p>
|
|
229
|
+
</div>
|
|
230
|
+
</form>
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
{{/if}}
|
|
238
|
+
|
|
239
|
+
{{#if telegram_token}}
|
|
240
|
+
<div class="disconnect-box">
|
|
241
|
+
<div class="disconnect">
|
|
242
|
+
<p class="title" style="margin-bottom: 20px;"> Disconnect</p>
|
|
243
|
+
|
|
244
|
+
<!-- Disconnect Button -->
|
|
245
|
+
{{#if telegram_token}}
|
|
246
|
+
<div>
|
|
247
|
+
{{#if brand_name}}
|
|
248
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is configured on your {{ brand_name }} project.</p>
|
|
249
|
+
{{else}}
|
|
250
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is configured on your Tiledesk project.</p>
|
|
251
|
+
{{/if}}
|
|
252
|
+
<p>By clicking on disconnect you will no longer be able to receive messages from the Telegram channel</p>
|
|
253
|
+
<form action="./disconnect" method="post">
|
|
254
|
+
<input type="hidden" name="project_id" value="{{ project_id }}">
|
|
255
|
+
<input type="hidden" name="token" value="{{ token }}">
|
|
256
|
+
<input type="hidden" name="subscriptionId" value="{{ subscriptionId }}">
|
|
257
|
+
<input type="submit" class="btn disconnect-button" style="margin-top: 10px; width: 160px;" value="Disconnect">
|
|
258
|
+
</form>
|
|
259
|
+
</div>
|
|
260
|
+
{{else}}
|
|
261
|
+
<!-- App not configured -->
|
|
262
|
+
{{#if brand_name}}
|
|
263
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is not yet configured on your {{ brand_name}} project.</p>
|
|
264
|
+
{{else}}
|
|
265
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is not yet configured on your Tiledesk project.</p>
|
|
266
|
+
{{/if}}
|
|
267
|
+
{{/if}}
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
{{else}}
|
|
271
|
+
<div class="disconnect-box" style="background-color: white;">
|
|
272
|
+
<div class="disconnect">
|
|
273
|
+
<p class="title" style="margin-bottom: 20px;"> Disconnect</p>
|
|
274
|
+
|
|
275
|
+
<!-- Disconnect Button -->
|
|
276
|
+
{{#if telegram_token}}
|
|
277
|
+
<div>
|
|
278
|
+
{{#if brand_name}}
|
|
279
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is configured on your {{ brand_name }} project.</p>
|
|
280
|
+
{{else}}
|
|
281
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is configured on your Tiledesk project.</p>
|
|
282
|
+
{{/if}}
|
|
283
|
+
<p>By clicking on disconnect you will no longer be able to receive messages from the Telegram channel</p>
|
|
284
|
+
<form action="./disconnect" method="post">
|
|
285
|
+
<input type="hidden" name="project_id" value="{{ project_id }}">
|
|
286
|
+
<input type="hidden" name="token" value="{{ token }}">
|
|
287
|
+
<input type="hidden" name="subscriptionId" value="{{ subscriptionId }}">
|
|
288
|
+
<input type="submit" class="btn disconnect-button" style="margin-top: 10px; width: 160px;" value="Disconnect">
|
|
289
|
+
</form>
|
|
290
|
+
</div>
|
|
291
|
+
{{else}}
|
|
292
|
+
<!-- App not configured -->
|
|
293
|
+
{{#if brand_name}}
|
|
294
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is not yet configured on your {{ brand_name}} project.</p>
|
|
295
|
+
{{else}}
|
|
296
|
+
<p style="color: rgb(140, 140, 140);">The Telegram App is not yet configured on your Tiledesk project.</p>
|
|
297
|
+
{{/if}}
|
|
298
|
+
{{/if}}
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
{{/if}}
|
|
302
|
+
|
|
303
|
+
<!--
|
|
304
|
+
<div class="version-box">
|
|
305
|
+
<div class="version">
|
|
306
|
+
<p class="version-title">App version: </p>
|
|
307
|
+
<div class="status-box" style="padding: 0px 20px; letter-spacing: 1px; height: 30px;">
|
|
308
|
+
<p style="margin-bottom: 0px;">{{ app_version }}</p>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
-->
|
|
313
|
+
|
|
314
|
+
<script>
|
|
315
|
+
|
|
316
|
+
function copyTextToClipboard() {
|
|
317
|
+
const proxyUrl = document.getElementById('proxy_url').select()
|
|
318
|
+
|
|
319
|
+
//document.querySelector('textarea').select();
|
|
320
|
+
try {
|
|
321
|
+
document.execCommand('copy');
|
|
322
|
+
console.log('Async: Copied to clipboard!');
|
|
323
|
+
let el1 = document.getElementById('copy-div');
|
|
324
|
+
el1.style.visibility = 'hidden';
|
|
325
|
+
|
|
326
|
+
let el2 = document.getElementById('copied-div');
|
|
327
|
+
el2.style.visibility = 'visible';
|
|
328
|
+
|
|
329
|
+
//let btn = document.getElementById('copy-btn');
|
|
330
|
+
//btn.value = "Copied!";
|
|
331
|
+
} catch (err) {
|
|
332
|
+
console.error('Async: Could not copy text: ', err);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function update_advanced() {
|
|
337
|
+
|
|
338
|
+
console.log("try to updated advanced options")
|
|
339
|
+
try {
|
|
340
|
+
document.getElementById("advanced_form").submit();
|
|
341
|
+
} catch (err) {
|
|
342
|
+
console.error('Async: could not update advanced options: ', err);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
}
|
|
346
|
+
</script>
|
|
347
|
+
|
|
348
|
+
</body>
|
|
349
|
+
</html>
|