A small PHP script that allows you to GET/PUT/POST text blobs.
It is intended for use with tada, though in theory can be used for other purposes.
Create a database and create the tables defined in sql/schema.sql
.
Edit index.php
to point to the correct database. If you're using SQLite,
then make sure the user Apache is running under has permissions to write
to the SQLite database file.
Optionally set up an .htaccess
file to ensure that https://SERVER/PATH/foo
is internally rewritten to https://SERVER/PATH/index.php/foo
. An example:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*) /PATH/index.php/$1 [L]
Insert rows into the user
table for as many users as you like:
INSERT INTO user (username, token) VALUES ('alice', 'ALICE-TOKEN-XYZ');
The following HTTP PUT
request should create a file:
PUT /PATH/index.php/some/file.txt
Authorization: Bearer ALICE-TOKEN-XYZ
Content-Type: text/plain
Host: SERVER
Here is the file content.
The following HTTP PUT
request should update the file with new content:
PUT /PATH/index.php/some/file.txt
Authorization: Bearer ALICE-TOKEN-XYZ
Content-Type: text/plain
Host: SERVER
Here is the new file content.
POST
will also work.
The following HTTP GET
request should retrieve the file:
GET /PATH/index.php/some/file.txt
Authorization: Bearer ALICE-TOKEN-XYZ
Host: SERVER
Updating a file supports the If-Match
and If-Unmodified-Since
headers,
which may help avoid race conditions.
By default, all users can read and write files that they own, and the initial
creator of a file will be the user to own it. The permission
table may be
used to provide read or write access to other users.
There is currently no UI for creating new users, editing permissions, listing files, etc.
Apache sometimes hides this from environment variables for security reasons.
Try using X-Tada-Authorization
in that case.
This project is triple licensed under the Apache License, version 2.0, the MIT License, and the GNU General Public License, version 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion into this project by you, shall be triple licensed as Apache-2.0/MIT/GPL-2.0, without any additional terms or conditions.