From b165b35b8b6736fa8c645507196a6c58869998a0 Mon Sep 17 00:00:00 2001
From: Zzm <1013452574@qq.com>
Date: Thu, 27 Jul 2017 02:13:57 +0800
Subject: [PATCH] Fixed remark error
Fixed remark error
---
Plugin/UnlimitedSocks/UnlimitedSocks.php | 3 +
Plugin/UnlimitedSocks/lang/chinese.php | 2 +-
Plugin/UnlimitedSocks/lang/english.php | 2 +-
Plugin/UnlimitedSocks/templates/details.tpl | 2 +-
.../templates/static/js/SSRscript.js | 80 +++++++++----------
README.md | 4 +-
6 files changed, 45 insertions(+), 48 deletions(-)
diff --git a/Plugin/UnlimitedSocks/UnlimitedSocks.php b/Plugin/UnlimitedSocks/UnlimitedSocks.php
index 541bbca..35cb373 100644
--- a/Plugin/UnlimitedSocks/UnlimitedSocks.php
+++ b/Plugin/UnlimitedSocks/UnlimitedSocks.php
@@ -417,6 +417,9 @@ function UnlimitedSocks_ClientArea(array $params){
$y = 0;
$ress = array();
foreach($nodee as $nodet){
+ if($y == 0){
+ $nodet = base64_encode($nodet);
+ }
$ress[$y] = $nodet;
$y ++;
if($y == 2 and !$detect->isMobile() and $params['configoption6'] == 1){
diff --git a/Plugin/UnlimitedSocks/lang/chinese.php b/Plugin/UnlimitedSocks/lang/chinese.php
index 1526595..bd500d7 100644
--- a/Plugin/UnlimitedSocks/lang/chinese.php
+++ b/Plugin/UnlimitedSocks/lang/chinese.php
@@ -54,7 +54,7 @@
//Ping测试
$_LANG['ping_test'] = "PING测试";
-$_LANG['test_user'] = "用户测试";
+$_LANG['test_user'] = "用户测试(需要HTTP)";
$_LANG['test_server'] = "服务器测试";
$_LANG['do_not_test'] = "不要测试";
$_LANG['ping_test_description'] = "Ping测试选项";
diff --git a/Plugin/UnlimitedSocks/lang/english.php b/Plugin/UnlimitedSocks/lang/english.php
index c81c069..294bd1a 100644
--- a/Plugin/UnlimitedSocks/lang/english.php
+++ b/Plugin/UnlimitedSocks/lang/english.php
@@ -54,7 +54,7 @@
//PingTest
$_LANG['ping_test'] = "PING Test";
-$_LANG['test_user'] = "User Test";
+$_LANG['test_user'] = "User Test(HTTP Request)";
$_LANG['test_server'] = "Server Test";
$_LANG['do_not_test'] = "Do Not Test";
$_LANG['ping_test_description'] = "Ping Test options";
\ No newline at end of file
diff --git a/Plugin/UnlimitedSocks/templates/details.tpl b/Plugin/UnlimitedSocks/templates/details.tpl
index 88426a8..4267991 100644
--- a/Plugin/UnlimitedSocks/templates/details.tpl
+++ b/Plugin/UnlimitedSocks/templates/details.tpl
@@ -134,7 +134,7 @@ background-color: rgba(0, 0, 0, .3);
{$yy = 0}
{foreach $nodes as $node }
- {$node[0]} |
+ {base64_decode($node[0])} |
{$node[7]} |
{$node[1]} |
{$node[2]} |
diff --git a/Plugin/UnlimitedSocks/templates/static/js/SSRscript.js b/Plugin/UnlimitedSocks/templates/static/js/SSRscript.js
index 760a2e5..1277f4a 100644
--- a/Plugin/UnlimitedSocks/templates/static/js/SSRscript.js
+++ b/Plugin/UnlimitedSocks/templates/static/js/SSRscript.js
@@ -1,41 +1,31 @@
-/*
- * ping.js - v0.1.0
- * Ping Utilities in Javascript
- * http://github.com/alfg/ping.js
- *
- * Made by Alfred Gutierrez
- * Under MIT License
- */
-/**
- * Creates a Ping instance.
- * @returns {Ping}
- * @constructor
- */
-var Ping = function() {};
-/**
- * Pings source and triggers a callback when completed.
- * @param source Source of the website or server, including protocol and port.
- * @param callback Callback function to trigger when completed.
- * @param timeout Optional number of milliseconds to wait before aborting.
- */
-Ping.prototype.ping = function(source, callback, timeout) {
+var Ping = function(opt) {
+ this.opt = opt || {};
+ this.favicon = this.opt.favicon || "/favicon.ico";
+ this.timeout = this.opt.timeout || 0;
+};
+Ping.prototype.ping = function(source, callback) {
this.img = new Image();
- timeout = timeout || 0;
var timer;
- var start = new Date();
- this.img.onload = this.img.onerror = pingCheck;
- if (timeout) { timer = setTimeout(pingCheck, timeout); }
- /**
- * Times ping and triggers callback.
- */
- function pingCheck() {
- if (timer) { clearTimeout(timer);}
+
+
+ this.img.onload = pingCheck;
+ this.img.onerror = pingCheck;
+ if (this.timeout) { timer = setTimeout(pingCheck, this.timeout); }
+ var start = new Date();
+ function pingCheck(e) {
+ if (timer) { clearTimeout(timer); }
var pong = new Date() - start;
+
if (typeof callback === "function") {
- callback(pong);
+ if (e.type === "error") {
+ console.error("error loading resource");
+ return callback("error", pong);
+ }
+ return callback(null, pong);
}
}
- this.img.src = source + "/?" + (+new Date()); // Trigger image load with cache buster
+
+ this.img.src = source + this.favicon + "?" + (+new Date()); // Trigger image load with cache buster
};
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function base64encode(str) {
@@ -69,24 +59,24 @@ function base64encode(str) {
return out;
}
$(document).ready(function() {
- /* Custom */
$('button[name="ping"]').on('click',function() {
var ping = new Ping();
var address = $(this).attr('data-host');
var timeout = 1000;
var _this = $(this);
- ping.ping('http://' + address,function(data) {
- if(data >= timeout) {
- _this.parents('td').html('X');
- } else {
- _this.parents('td').html('√');
- }
- },timeout);
+ ping.ping('http://' + address,function(err,data) {
+ if (err) {
+ data = data + " " + err;
+ _this.parents('td').html('' + data + '');
+ }else{
+ _this.parents('td').html('' + data + '');
+ }
+ });
});
jQuery(document).ready(function($) {
$("button[name='qrcode']").on('click',function() {
if($(this).attr('data-type').indexOf("ssr")!=-1){
- str = $(this).attr('data-params') + base64encode($(this).attr('data-pass')) + '/?obfsparam=' + base64encode($(this).attr('data-obfsparam')) + '&protoparam=' + base64encode($(this).attr('data-protoparam')) + '&remarks=' + base64encode($(this).attr('data-note')) ;
+ str = $(this).attr('data-params') + base64encode($(this).attr('data-pass')) + '/?obfsparam=' + base64encode($(this).attr('data-obfsparam')) + '&protoparam=' + base64encode($(this).attr('data-protoparam')) + '&remarks=' + $(this).attr('data-note') ;
} else {
str = $(this).attr('data-params-SS');
}
@@ -103,12 +93,14 @@ $(document).ready(function() {
});
$("button[name='url']").on('click',function() {
if($(this).attr('data-type').indexOf("ssr")!=-1){
- str = $(this).attr('data-params') + base64encode($(this).attr('data-pass')) + '/?obfsparam=' + base64encode($(this).attr('data-obfsparam')) + '&protoparam=' + base64encode($(this).attr('data-protoparam')) + '&remarks=' + base64encode($(this).attr('data-note')) ;
+ str = $(this).attr('data-params') + base64encode($(this).attr('data-pass')) + '/?obfsparam=' + base64encode($(this).attr('data-obfsparam')) + '&protoparam=' + base64encode($(this).attr('data-protoparam')) + '&remarks=' + $(this).attr('data-note') ;
+ str = base64encode(str);
+ str = 'ssr://' + str;
} else {
str = $(this).attr('data-params-SS');
+ str = base64encode(str);
+ str = 'ss://' + str;
}
- str = base64encode(str);
- str = $(this).attr('data-type') + '://' + str;
layer.alert(str);
});
});
diff --git a/README.md b/README.md
index 4ce14b5..fecd144 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,7 @@
* based on https://github.com/kesuki/whmcs-shadowsocks-plugin which is based on frankwei's project
* fixed QRcode support for ssr|已修复二维码支持
* added traffic chart support|添加用户流量图表
+* fixed utf-8 error|修复中文备注乱码问题
## TO-DO List
* ~~Readd custom traffic module|重新添加自定义流量系统~~
@@ -12,7 +13,7 @@
* ~~Add Ping Test switch function|添加PING测试选项切换支持~~
* ~~Add Random Password Support|添加随机密码支持~~
* Add additional bandwidth|添加额外流量包功能
-* Add Admin Dashboard|添加管理员面板
+* Add Admin Dashboard|添加管理员面板(30%Progess|进程30%)
## Attentions
* You must add a server and select it in Product->Module Settings|请添加服务器并在产品->模块设置中选择服务器
@@ -26,6 +27,7 @@
## Other
# More Info in|更多详情请访问 http://www.mak-blog.com/whmcs-shadowsocks-plugin.html
+# 或者 http://www.loli.ren/index.php/2017/07/24/unlimitedsocks%E5%AE%89%E8%A3%85%E6%96%B9%E6%B3%95/ 密码 Zzm317!
* BTW I think a developer's most important ability is to obey the Open-Source Rules
* Not the coding level he can achieve