Browse Source

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
pull/39/head
Aaron Parecki 8 years ago
parent
commit
4a08c1fd2f
No known key found for this signature in database GPG Key ID: 276C2817346D6056
8 changed files with 54 additions and 4 deletions
  1. +4
    -0
      .htaccess
  2. +34
    -2
      README.md
  3. +1
    -0
      controllers/.htaccess
  4. +7
    -0
      index.php
  5. +1
    -0
      lib/.htaccess
  6. +4
    -0
      public/.htaccess
  7. +1
    -0
      views/.htaccess
  8. +2
    -2
      views/index.php

+ 4
- 0
.htaccess View File

@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

+ 34
- 2
README.md View File

@ -1,6 +1,8 @@
XRay XRay
==== ====
XRay parses structured content from a URL.
## Discovering Content ## 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/ 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 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 ### 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 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. * `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;
```

+ 1
- 0
controllers/.htaccess View File

@ -0,0 +1 @@
deny from all

+ 7
- 0
index.php View File

@ -0,0 +1,7 @@
<?php
/*
This file exists here in case you happen to drop the whole XRay folder onto a web server and serve this directory.
Ideally you should configure your web server to serve the "public" folder as the root.
*/
require('public/index.php');

+ 1
- 0
lib/.htaccess View File

@ -0,0 +1 @@
deny from all

+ 4
- 0
public/.htaccess View File

@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

+ 1
- 0
views/.htaccess View File

@ -0,0 +1 @@
deny from all

+ 2
- 2
views/index.php View File

@ -5,14 +5,14 @@
<h1>X-Ray</h1> <h1>X-Ray</h1>
<div class="section url-form"> <div class="section url-form">
<form class="" action="/parse" method="get">
<form class="" action="parse" method="get">
<div class="field"><input type="url" name="url" placeholder="http://example.com"></div> <div class="field"><input type="url" name="url" placeholder="http://example.com"></div>
<div class="field"><button type="submit" class="button" value="Go">Go</button></div> <div class="field"><button type="submit" class="button" value="Go">Go</button></div>
</form> </form>
</div> </div>
<div class="section html-form"> <div class="section html-form">
<form class="" action="/parse" method="post">
<form class="" action="parse" method="post">
<div class="field"><textarea name="html" rows="4" placeholder="HTML"></textarea></div> <div class="field"><textarea name="html" rows="4" placeholder="HTML"></textarea></div>
<div class="field"><input type="url" name="url" placeholder="http://example.com"></div> <div class="field"><input type="url" name="url" placeholder="http://example.com"></div>
<div class="field"><input type="submit" class="button" value="Go"></div> <div class="field"><input type="submit" class="button" value="Go"></div>

Loading…
Cancel
Save