diff --git a/README.md b/README.md index aacb8068..04d6259d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Just a simple open-source Minecraft skin server write in PHP. [Live demo](https://work.prinzeugen.net/blessing-skin-server/) - + Features: ----------- @@ -31,8 +31,13 @@ Add rewrite rules to your nginx.conf: location / { rewrite ^/([^/]*).json$ /get.php?type=json&uname=$1 last; rewrite ^/(skin|cape)/([^/]*).png$ /get.php?type=$1&uname=$2 last; + # Optional + rewrite ^/(usm|csl)/([^/]*).json$ /get.php?type=json&uname=$2&api=$1 last; + rewrite ^/(usm|csl)/textures/(.*)$ /textures/$2 last; } ``` +You can also use optional rewrite rules to support both CustomSkinLoader API & UniSkinAPI. (Access `example.com/(usm|csl)/username.json` to get json for CustomSkinLoader API or UniSkinAPI) + If you installed the skin server to subdirectory, be careful of your `location`. Now you can access `http://example.com/username.json` to get your json profile. After uploading skins, you can also access `http://example.com/skin/username.png` for skin image or `http://example.com/cape/username.png` for cape. diff --git a/admin/admin_ajax.php b/admin/admin_ajax.php index af1ce3c2..070cdc5c 100644 --- a/admin/admin_ajax.php +++ b/admin/admin_ajax.php @@ -3,12 +3,11 @@ * @Author: prpr * @Date: 2016-02-04 13:53:55 * @Last Modified by: prpr - * @Last Modified time: 2016-02-04 17:14:06 + * @Last Modified time: 2016-02-04 18:42:22 */ session_start(); $dir = dirname(dirname(__FILE__)); require "$dir/includes/autoload.inc.php"; -require "$dir/config.php"; if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) { $_SESSION['uname'] = $_COOKIE['uname']; @@ -61,6 +60,16 @@ if (isset($_GET['action'])) { $user->unRegister(); $json['errno'] = 0; $json['msg'] = "Account successfully deleted."; + } else if ($action == "model") { + if (isset($_POST['model']) && $_POST['model'] == 'slim' || $_POST['model'] == 'default') { + $user->setPreference($_POST['model']); + $json['errno'] = 0; + $json['msg'] = "Model preference of ".$_GET['uname']." changed to ".$_POST['model']." successfully."; + } else { + utils::raise(1, 'Illegal parameters'); + } + } else { + utils::raise(1, 'Illegal parameters'); } } diff --git a/admin/index.php b/admin/index.php index 18a02534..d1d0ede8 100644 --- a/admin/index.php +++ b/admin/index.php @@ -3,13 +3,12 @@ * @Author: prpr * @Date: 2016-02-03 14:39:50 * @Last Modified by: prpr - * @Last Modified time: 2016-02-04 17:32:11 + * @Last Modified time: 2016-02-04 23:45:06 */ session_start(); $dir = dirname(dirname(__FILE__)); require "$dir/includes/autoload.inc.php"; -require "$dir/config.php"; if(isset($_COOKIE['uname']) && isset($_COOKIE['token'])) { $_SESSION['uname'] = $_COOKIE['uname']; @@ -52,7 +51,7 @@ if (isset($_SESSION['uname'])) { Profile