From 4a08c1fd2fc16106038aedebfe48f0a947c1dde1 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Wed, 11 Jan 2017 09:53:58 -0800 Subject: [PATCH] package for releasing to shared servers * adds .htaccess files for apache * adds installation instructions and nginx example * prevent source folders from being viewed with .htaccess * adds `index.php` in root folder in case you deploy this whole thing to a subfolder * updates to work when installed in a subfolder --- .htaccess | 4 ++++ README.md | 36 ++++++++++++++++++++++++++++++++++-- controllers/.htaccess | 1 + index.php | 7 +++++++ lib/.htaccess | 1 + public/.htaccess | 4 ++++ views/.htaccess | 1 + views/index.php | 4 ++-- 8 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .htaccess create mode 100644 controllers/.htaccess create mode 100644 index.php create mode 100644 lib/.htaccess create mode 100644 public/.htaccess create mode 100644 views/.htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..baf1d3b --- /dev/null +++ b/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule . index.php [L] diff --git a/README.md b/README.md index f22c564..d5ed8f2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ XRay ==== +XRay parses structured content from a URL. + ## Discovering Content @@ -23,7 +25,7 @@ To parse a page and return structured data for the contents of the page, simply GET /parse?url=https://aaronparecki.com/2016/01/16/11/ ``` -To conditionally parse the page after first checking if it contains a link to a target URL, also include the target URL as a parameter. This is useful if using XRay to verify an incoming webmention. +To conditionally parse the page after first checking if it contains a link to a target URL, also include the target URL as a parameter. This is useful when using XRay to verify an incoming webmention. ``` GET /parse?url=https://aaronparecki.com/2016/01/16/11/&target=http://example.com @@ -35,7 +37,7 @@ You can also make a POST request with the same parameter names. ### Authentication -If the URL you are fetching requires authentication, include the access token in the parameter "token", and it will be included in an "Authorization" header when fetching the URL. (It is recommended to use a POST request in this case, to avoid the access token potentially being logged as part of the query string.) +If the URL you are fetching requires authentication, include the access token in the parameter "token", and it will be included in an "Authorization" header when fetching the URL. (It is recommended to use a POST request in this case, to avoid the access token potentially being logged as part of the query string.) This is useful for [Private Webmention](https://indieweb.org/Private-Webmention) verification. ``` POST /parse @@ -187,3 +189,33 @@ If there was a problem fetching the access token, you will get one of the errors * `no_token_endpoint` - Unable to find an HTTP header specifying the token endpoint. +## Installation + +### From Source + +``` +# Clone this repository + +git clone git@github.com:aaronpk/XRay.git +cd XRay + +# Install dependencies +composer install +``` + +### From Zip Archive + +* Download the latest release from https://github.com/aaronpk/XRay/releases +* Extract to a folder on your web server + + +### Web Server Configuration + +Configure your web server to point to the `public` folder. + +Make sure all requests are routed to `index.php`. XRay ships with `.htaccess` files for Apache. For nginx, you'll need a rule like the following in your server config block. + +``` + try_files $uri /index.php?$args; +``` + diff --git a/controllers/.htaccess b/controllers/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/controllers/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..8ea0ee1 --- /dev/null +++ b/index.php @@ -0,0 +1,7 @@ +X-Ray
-
+
-
+