diff --git a/.gitignore b/.gitignore index 9dc2a0c..fea6afe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules dist wrangler.* +!wrangler.example.toml config.json config.prod.json \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..28d7433 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +This is a `mod_http_upload_external`-compatible XEP-0363 file server for Prosody and eJabberd implemented on Cloudflare Workers with S3-compatible backend support. + +To use it, you need to fill in `config.prod.json` using `config.example.json` as a template, and then create `wrangler.prod.toml` based on `wrangler.example.toml`. Most of the fields should be pretty self-explanatory. To publish it to your Cloudflare account, run `npm run publish-prod`. + +To configure eJabberd to use the endpoint exposed by this service, add + +```yaml + mod_http_upload: + put_url: https:/// + get_url: https:/// + external_secret: +``` + +to `ejabberd.yaml`. \ No newline at end of file diff --git a/config.example.json b/config.example.json new file mode 100644 index 0000000..5d3d102 --- /dev/null +++ b/config.example.json @@ -0,0 +1,12 @@ +{ + "xmpp_secret": "", + "s3": { + "endpoint": "https://", + "bucket": "" + }, + "aws": { + "accessKeyId": "", + "secretAccessKey": "", + "region": "" + } +} \ No newline at end of file diff --git a/wrangler.example.toml b/wrangler.example.toml new file mode 100644 index 0000000..780601c --- /dev/null +++ b/wrangler.example.toml @@ -0,0 +1,11 @@ +name = "" +type = "javascript" +zone_id = "" +account_id = "" +route = "" +workers_dev = true + +[build] +command = "npm install && npm run build" +[build.upload] +format = "service-worker" \ No newline at end of file