diff --git a/.env.sample b/.env.sample index d0698531a..66b83dc1b 100644 --- a/.env.sample +++ b/.env.sample @@ -1,4 +1,6 @@ # Copy this file to .env, remove this comment and change the keys +# +# Please use `openssl rand -hex 32` to create SEQUELIZE_SECRET DATABASE_URL=postgres://user:pass@example.com:5432/atlas DATABASE_URL_TEST=postgres://user:pass@example.com:5432/atlas-test diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..b5cec1326 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 Atlas (https://www.beautifulatlas.com/) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Atlas nor the names of its contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md index 84757702f..89b7d70ac 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,23 @@ ![](https://circleci.com/gh/jorilallo/atlas.svg?style=shield&circle-token=c0c4c2f39990e277385d5c1ae96169c409eb887a) +Atlas is a modern wiki for your team built using React and Node.js. [https://www.beautifulatlas.com/](https://www.beautifulatlas.com/) + ## Installation +Atlas requires following dependencies to work: + +- Postgres >=9.5 +- Redis +- S3 bucket configured to support CORS uploads +- Slack developer application + +To install and run the application: + 1. Install dependencies with `yarn` 1. Register a Slack app at https://api.slack.com/apps 1. Copy the file `.env.sample` to `.env` and fill out the keys - 1. Run DB migrations `yarn sequelize -- db:migrate` + 1. Run DB migrations `yarn sequelize db:migrate` 1. Start the development server `yarn start` @@ -25,3 +36,8 @@ Or to run migrations on test database: ``` yarn sequelize db:migrate --env test ``` + + +## License + +Atlas is [BSD licensed](/blob/master/LICENSE). diff --git a/server/api/user.js b/server/api/user.js index a68dcedcf..64b3676fb 100644 --- a/server/api/user.js +++ b/server/api/user.js @@ -18,7 +18,7 @@ router.post('user.s3Upload', auth(), async ctx => { ctx.assertPresent(size, 'size is required'); const s3Key = uuid.v4(); - const key = `${s3Key}/${filename}`; + const key = `uploads/${ctx.state.user.id}/${s3Key}/${filename}`; const policy = makePolicy(); ctx.body = { @@ -36,7 +36,7 @@ router.post('user.s3Upload', auth(), async ctx => { }, asset: { contentType: kind, - url: `${process.env.AWS_S3_UPLOAD_BUCKET_URL}${s3Key}/${filename}`, + url: `${process.env.AWS_S3_UPLOAD_BUCKET_URL}${key}`, name: filename, size, },