fix Tawk.to

This commit is contained in:
iBNu Maksum 2024-11-05 12:07:54 +07:00
parent b28b40280f
commit 7f35e7fb68
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
5 changed files with 33 additions and 26 deletions

View File

@ -26,6 +26,15 @@ class User
return 0; return 0;
} }
public static function getTawkToHash($email)
{
global $config;
if (!empty($config['tawkto_api_key']) && !Empty($email)) {
return hash_hmac('sha256', $email, $config['tawkto_api_key']);
}
return '';
}
public static function getBills($id = 0) public static function getBills($id = 0)
{ {
if (!$id) { if (!$id) {

View File

@ -845,5 +845,6 @@
"Enable_CSRF_Validation": "Aktifkan Validasi CSRF", "Enable_CSRF_Validation": "Aktifkan Validasi CSRF",
"Cross_site_request_forgery": "Pemalsuan permintaan lintas situs", "Cross_site_request_forgery": "Pemalsuan permintaan lintas situs",
"Forgot_Password": "Lupa Kata Sandi", "Forgot_Password": "Lupa Kata Sandi",
"Validity_Periode": "Periode Validitas" "Validity_Periode": "Periode Validitas",
"Transaction_History_List": "Daftar Riwayat Transaksi"
} }

View File

@ -105,9 +105,7 @@
placeholder="{Lang::T('Cash')}, {Lang::T('Bank Transfer')}"> placeholder="{Lang::T('Cash')}, {Lang::T('Bank Transfer')}">
</div> </div>
<p class="help-block col-md-4"> <p class="help-block col-md-4">
{Lang::T('This used for admin to select payment in recharge, using comma for {Lang::T('This used for admin to select payment in recharge, using comma for every new options')}
every new
options')}
</p> </p>
</div> </div>
@ -844,6 +842,13 @@
</div> </div>
<p class="help-block col-md-4">{Lang::T('From Direct Chat Link.')}</p> <p class="help-block col-md-4">{Lang::T('From Direct Chat Link.')}</p>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label">Tawk.to Javascript API key</label>
<div class="col-md-6">
<input type="text" class="form-control" id="tawkto_api_key" name="tawkto_api_key" value="{$_c['tawkto_api_key']}"
placeholder="39e52264cxxxxxxxxxxxxxdd078af5342e8">
</div>
</div>
<label class="col-md-2"></label> <label class="col-md-2"></label>
<p class="col-md-6 help-block">/ip hotspot walled-garden<br> <p class="col-md-6 help-block">/ip hotspot walled-garden<br>
add dst-host=tawk.to<br> add dst-host=tawk.to<br>

View File

@ -59,31 +59,23 @@
var isLoggedIn = false; var isLoggedIn = false;
var Tawk_API = { var Tawk_API = {
onLoad: function() { onLoad: function() {
if (!isLoggedIn) { Tawk_API.setAttributes({
isLoggedIn = true; 'username' : '{$_user['username']}',
window.Tawk_API.login({ 'service' : '{$_user['service_type']}',
name: '{$_user['fullname']}', 'balance' : '{$_user['balance']}',
email: '{$_user['email']}', 'account' : '{$_user['account_type']}',
userId: '{$_user['id']}' 'phone' : '{$_user['phonenumber']}'
}, function(error) { }, function(error) {
//do something if there's an error console.log(error)
}); });
}
Tawk_API.setAttributes({
'id' : '{$_user['id']}',
'username' : '{$_user['username']}',
'service_type' : '{$_user['service_type']}',
'balance' : '{$_user['balance']}',
'account_type' : '{$_user['account_type']}',
'phone' : '{$_user['phonenumber']}'
}, function(error) {});
} }
}; };
var Tawk_LoadStart = new Date(); var Tawk_LoadStart = new Date();
Tawk_API.visitor = { Tawk_API.visitor = {
name : '{$_user['fullname']}', name: '{$_user['fullname']}',
email : '{$_user['email']}', email: '{$_user['email']}',
userId: '{$_user['id']}' phone: '{$_user['phonenumber']}'
}; };
(function() { (function() {
var s1 = document.createElement("script"), var s1 = document.createElement("script"),

View File

@ -1,3 +1,3 @@
{ {
"version": "2024.11.4" "version": "2024.11.5"
} }