diff --git a/README.md b/README.md index 3a06d78..b5d778d 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The contents of the URL is checked in the following order: * h-review * h-recipe * h-product + * h-item ## Library diff --git a/controllers/Parse.php b/controllers/Parse.php index dbc05e4..ffc1c29 100644 --- a/controllers/Parse.php +++ b/controllers/Parse.php @@ -10,9 +10,10 @@ class Parse { public $mc; private $_cacheTime = 120; private $_pretty = false; + private static $_version = '1.2.1'; public static function useragent() { - return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 XRay/1.0.0 ('.\Config::$base.')'; + return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 XRay/'.self::$_version.' ('.\Config::$base.')'; } public function __construct() { @@ -35,6 +36,7 @@ class Parse { $response->headers->set($k, $v); } $response->headers->set('Content-Type', 'application/json'); + $response->headers->set('Version', 'XRay/'.self::$_version.' php-mf2/'.p3k\XRay\phpmf2_version()); $opts = JSON_UNESCAPED_SLASHES; if($this->_pretty) $opts += JSON_PRETTY_PRINT; $response->setContent(json_encode($params, $opts)."\n"); diff --git a/lib/helpers.php b/lib/helpers.php index 66c644f..1468ad3 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -36,3 +36,14 @@ function should_follow_redirects($url) { return true; } } + +function phpmf2_version() { + $composer = json_decode(file_get_contents(dirname(__FILE__).'/../composer.lock')); + $version = 'unknown'; + foreach($composer->packages as $pkg) { + if($pkg->name == 'mf2/mf2') { + $version = $pkg->version; + } + } + return $version; +} diff --git a/release-library.sh b/release-library.sh new file mode 100755 index 0000000..510000d --- /dev/null +++ b/release-library.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +release_dir=../XRay-library-release + +current=`pwd` + +composer install --no-dev + +rsync -ap --delete controllers $release_dir/ +rsync -ap --delete lib $release_dir/ +rsync -ap --delete public $release_dir/ +rsync -ap --delete views $release_dir/ +rsync -ap --delete --exclude=.git vendor $release_dir/ +cp README.md $release_dir/ +cp LICENSE.txt $release_dir/ +cp index.php $release_dir/ +cp .htaccess $release_dir/ +cp controllers/.htaccess $release_dir/vendor/ + +cd $release_dir +zip -r xray.zip . + +cd $current diff --git a/release.sh b/release.sh index 7e1bc91..d01f07f 100755 --- a/release.sh +++ b/release.sh @@ -4,6 +4,8 @@ release_dir=../XRay-release current=`pwd` +composer install + rsync -ap --delete controllers $release_dir/ rsync -ap --delete lib $release_dir/ rsync -ap --delete public $release_dir/