Commit graph

60 commits

Author SHA1 Message Date
Mayank Gautam
c9b40bbd74 added undefined filePath check in the method resolvePathToFile 2020-03-30 16:58:53 -04:00
Cassie Tarakajian
70036d3e3a fixes #1219 2020-01-28 16:56:44 -05:00
Cassie Tarakajian
3d2a7beeb9 merge master to feature/public-api branch 2019-10-22 17:35:20 -04:00
Frank Winter
0b36126854 Change DELETE request for projects Fixes #1165 (#1172)
* Change DELETE request for projects

* fixes #1165, by updating requestsOfType to check for null or undefined values

* remove unnecessary whitespace changes
2019-10-02 16:18:54 -04:00
Cassie Tarakajian
02f4cb23b4 fixes #1162, fixes #1118 2019-09-26 16:17:22 -04:00
Andrew Nicolaou
d44a058fd8 Public API: Create new project (fixes #1095) (#1106)
* Converts import script to use public API endpoints

The endpoints don't exist yet, but this is a good way to see how
the implementation of the data structures differ.

* Exposes public API endpoint to fetch user's sketches

* Implements public API delete endpoint

* Adds helper to create custom ApplicationError classes

* Adds create project endpoint that understand API's data structure

This transforms the nested tree of file data into a mongoose
Project model

* Returns '201 Created' to match API spec

* Removes 'CustomError' variable assignment as it shows up in test output

* transformFiles will return file validation errors

* Tests API project controller

* Tests toModel()

* Creates default files if no root-level .html file is provided

* Do not auto-generate a slug if it is provided

Fixes a bug where the slug was auto-generated using the sketch name,
even if a slug property had been provided.

* Validates uniqueness of slugs for projects created by the public API

* Adds tests for slug uniqueness

* Configures node's Promise implementation for mongoose (fixes warnings)

* Moves createProject tests to match controller location

* Adds support for code to ApplicationErrors

* deleteProject controller tests

* getProjectsForUser controller tests

- implements tests
- update apiKey tests to use new User mocks

* Ensure error objects have consistent property names

`message` is used as a high-level description of the errors
`detail` is optional and has an plain language explanation of the
individual errors
`errors` is an array of each individual problem from `detail` in a
machine-readable format

* Assert environment variables are provided at script start

* Version public API

* Expect "files" property to always be provided

* Fixes linting error

* Converts import script to use public API endpoints

The endpoints don't exist yet, but this is a good way to see how
the implementation of the data structures differ.

* Exposes public API endpoint to fetch user's sketches

* Implements public API delete endpoint

* Adds helper to create custom ApplicationError classes

* Adds create project endpoint that understand API's data structure

This transforms the nested tree of file data into a mongoose
Project model

* Returns '201 Created' to match API spec

* Removes 'CustomError' variable assignment as it shows up in test output

* transformFiles will return file validation errors

* Tests API project controller

* Tests toModel()

* Creates default files if no root-level .html file is provided

* Do not auto-generate a slug if it is provided

Fixes a bug where the slug was auto-generated using the sketch name,
even if a slug property had been provided.

* Validates uniqueness of slugs for projects created by the public API

* Adds tests for slug uniqueness

* Configures node's Promise implementation for mongoose (fixes warnings)

* Moves createProject tests to match controller location

* deleteProject controller tests

* Adds support for code to ApplicationErrors

* getProjectsForUser controller tests

- implements tests
- update apiKey tests to use new User mocks

* Ensure error objects have consistent property names

`message` is used as a high-level description of the errors
`detail` is optional and has an plain language explanation of the
individual errors
`errors` is an array of each individual problem from `detail` in a
machine-readable format

* Assert environment variables are provided at script start

* Version public API

* Expect "files" property to always be provided

* Fixes linting error

* Checks that authenticated user has permission to create under this namespace

Previously, the project was always created under the authenticated user's
namespace, but this not obvious behaviour.
2019-08-30 14:26:57 -04:00
Andrew Nicolaou
cd21e9ae72 Fixes bug where requestsOfType() would fail if no body
- Passes if request has no body
- Returns a JSON object with an error message when request
  doesn't match type, the response body was "[object Object]"
2019-07-22 16:09:11 -04:00
Andrew Nicolaou
7fdd970a43 Fixes bug where requestsOfType() would fail if no body
- Passes if request has no body
- Returns a JSON object with an error message when request
  doesn't match type, the response body was "[object Object]"
2019-07-22 15:03:31 -04:00
Cassie Tarakajian
3a1b8abac1 fix lint error 2019-02-20 14:57:26 -05:00
Gaurang Tandon
bd3eed5fd3 reverted some changes and changed to file system safe naming 2019-02-10 06:57:03 +05:30
Gaurang Tandon
d86944034e fix lint errors 2018-12-15 12:43:58 +05:30
Gaurang Tandon
26d65396b4 fixes #568 2018-12-15 12:35:52 +05:30
Cassie Tarakajian
4a2d6d3035 fixes #668 2018-08-29 15:06:41 -04:00
Jared Donovan
903713e705 WIP - Mixed content error for Issue #543 (#661)
* Set trust proxy option on Express app.

* Fix replacement of filePath for full screen and embed sketches.

* Use const rather than let because  is never reassigned.
2018-07-03 13:02:46 -07:00
Cassie Tarakajian
9958619fc4 fixes #630 and updates codemirror 2018-05-30 15:23:32 -07:00
Cassie Tarakajian
c90dac55b7 update eslint and fix linting errors 2018-05-08 19:16:04 -07:00
Cassie Tarakajian
3307613aec
adds slugify feature for #522 (#523) 2018-02-07 16:00:09 -05:00
Cassie Tarakajian
6cd71acb81
update list of mime types and move to common server and client file (#511)
Fixes #476 and fixes #450
2018-02-01 16:45:19 -05:00
Cassie Tarakajian
c50f64c0f3 fix linting errors 2018-01-09 16:21:40 -05:00
Cassie Tarakajian
fb1684ce4b add isAuthenticated middleware, add isAuthenticated middleware to certain routes, make all other routes consistent 2018-01-09 15:57:49 -05:00
Francis Li
82ca755362 Fixes #489, only logs request in development (#490) 2017-12-08 14:50:53 -05:00
Cassie Tarakajian
03eae2f1ef fixes #479 and fixes #449 2017-11-28 14:48:50 -05:00
Andrew Nicolaou
6cbc376d6e CSRF/XSS protection (#374)
* /api endpoints only allows requests with application/json Content-Type

Otherwise sends 406 Unacceptable

* Uses CSRF token

The CSRF token is sent as the cookie 'XSRF-TOKEN' on all HTML page
requests. This token is  picked up automatically by axios
and sent to the API with all requests as an 'X-XSRF-TOKEN' header.
The middleware runs on all routes and verifies that the token matches
what's stored in the session.
2017-06-26 13:58:58 -04:00
Andrew Nicolaou
1dc0c22cb7 Email verification (#369)
* Re-introduce Email Verification code

Revert "Revert "Email verification""
This reverts commit d154d8bff259350523a0f139e844db96c43d2ee1.

* Uses MJML to generate Reset Password email

* Sends Password Reset and Email Confirmation emails using MJML template

* Sends verified status along with user data

* API endpoint for resending email verification confirmation

* Displays verification status on Account page and allows resending

* Send back error string

* Passes email address through to sign/verify helper

* Uses enum-style object to set verified state

* Sends minimal info when user verifies since it can be done without login

* Provides /verify UI and sends confirmation token to API

* Better name for JWT secret token env var

* Adds mail config variables to Readme

* Encrypts email address in JWT

The JWT sent as the token in the Confirm Password URL
can be unencoded by anyone, although it's signature can only
be verified by us. To ensure that no passwords are leaked,
we encrypt the email address before creating the token.

* Removes unused mail templates

* Resets verified flag when email is changed and sends another email

* Moves email confirmation functions next to each other

* Extracts random token generator to helper

* Moves email confirmation actions into Redux

- updates the AccountForm label with a message to check inbox
- show status when verifying email token

* Uses generated token stored in DB for email confirmation

* Sets email confirmation status to verified if logging in from Github

* Sends email using new method on account creation

* Fixes linting errors

* Removes replyTo config
2017-06-26 12:48:28 -04:00
Cassie Tarakajian
1ae37ebaaa fix lingering linting errors 2017-06-13 16:47:36 -04:00
Cassie Tarakajian
aaa5e868e2 make inital changes for #169--need to migrate the locations of a user's s3 files to be namespaced under their userid 2017-04-06 14:34:14 -04:00
Cassie Tarakajian
fa04054d28 duplicating files works 2017-04-05 23:23:38 -04:00
Cassie Tarakajian
f01a58353b initial commit to cloning files on S3, untested 2017-04-05 23:23:37 -04:00
Cassie Tarakajian
e87390adb9 update eslint to latest version, fix lots of linting errors (#308)
* update eslint and dependencies, fix linting errors that can be fixed with --fix

* fix lots of linting errors

* update eslintrc, fix some linting errors

* fix all server side linting errors, untested

* fix errors that fixing linting errors had caused

* fix client side eslint errors

* fix client side linting errors

* fix refs lint errors

* fix more linting errors

* update eslint and dependencies, fix linting errors that can be fixed with --fix

* fix lots of linting errors

* update eslintrc, fix some linting errors

* fix all server side linting errors, untested

* fix errors that fixing linting errors had caused

* fix client side eslint errors

* fix client side linting errors

* fix refs lint errors

* fix more linting errors

* fix some accessibility linting errors

* fix a lot of linting errors

* fix a billion more linting errors

* hopefully fix all linting errors, still need to test

* fix bugs that fixing linting had caused
2017-02-22 14:29:35 -05:00
Cassie Tarakajian
52a28328e4 fix #302 2017-02-14 15:54:29 -05:00
Cassie Tarakajian
311e8442a1 Revert "Email verification" (#265) 2017-01-13 10:35:39 -05:00
Akarshit Wal
2d781e22fb Email verification (#230)
* Making the email separate for future enhancements

* email-verification added

* Github users are verified

* update package

* Bug fixes and improvements

* jade to pug

* Bug fix

* changed route
2017-01-13 10:24:09 -05:00
Cassie Tarakajian
fc8318c297 fix some linting errors 2017-01-11 15:50:36 -05:00
Cassie Tarakajian
1d6e59ada3 add lint-fix task, fix linting errors in fetching examples code 2017-01-11 15:17:10 -05:00
Cassie Tarakajian
3b93a5ff19 remove deletion step 2016-12-13 20:47:19 -05:00
Cassie Tarakajian
1e90ea1437 add s3 deletion script 2016-12-13 20:45:30 -05:00
Cassie Tarakajian
14d1c33951 more s3 script testing 2016-12-13 20:36:48 -05:00
Cassie Tarakajian
c9df78a667 add to s3 script 2016-12-13 20:32:57 -05:00
Cassie Tarakajian
ebb7729fd0 log total files to delete 2016-12-13 20:12:17 -05:00
Cassie Tarakajian
5f106cd378 remove console.log 2016-12-13 20:09:41 -05:00
Cassie Tarakajian
5711c3b4da start to add file to delete unused files from S3 2016-12-13 20:07:02 -05:00
Cassie Tarakajian
fd26b3f77c add otf and ttf to media file list for preview generation 2016-11-30 11:51:54 -05:00
Cassie Tarakajian
af3cb60ce1 fix linting errors that are fixable with --fix in server side code 2016-11-17 11:15:35 -05:00
Cassie Tarakajian
04922522cc cool to share some of this code between client and server
Squashed commit of the following:

commit fb5e82cea930b011792983c7d1cc9f6ecacc7dd4
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Wed Nov 16 12:28:10 2016 -0500

    add server side rendering, untested

commit 5c60fb30c46ea49a8d9a0ecb56f39ec778464a8b
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Tue Nov 15 18:26:06 2016 -0500

    add redux-form bandage post react update, should probably update to redux-form 6 at some point

commit 057b5871e7137179abc93f7821a9690f0ea52c92
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Tue Nov 15 16:30:09 2016 -0500

    remove passing jsFiles and cssFiles to PreviewFrame, fix rendering bug

commit 88c56fd36d3a8d88902c79642171988ce37825f2
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Tue Nov 15 16:21:59 2016 -0500

    code cleanup, untested

commit 82e5dcf8bca461892f1daf06d38f1eaebe72983f
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Tue Nov 15 15:53:50 2016 -0500

    update react and react router, fix a few bugs in rendering code, add ability to parse inline js and css

commit e02f4b67803ea45328eff4e53659222f3149964c
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Tue Nov 15 14:43:38 2016 -0500

    add almost full code to create preview html correctly, untested

commit 12f61b2a1aed4607fab24d01572b647ca6210262
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Wed Nov 2 17:09:26 2016 -0400

    refactor some of the preview html generation code

commit 111825846703d5c8959cb18795a3aadb7ebe505c
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Wed Nov 2 11:06:36 2016 -0400

    add comments as plan of action

commit 1cc2cf5203674732b4057382f1937de38b687078
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Thu Oct 27 19:34:55 2016 -0400

    add href parsing

commit e67189298cda9b70645f454ecd541a363980f0e4
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Thu Oct 27 10:48:36 2016 -0400

    continue parsing html

commit 1458fb940a15a3dc5d74890211a3073e920b84b8
Author: Cassie Tarakajian <ctarakajian@gmail.com>
Date:   Wed Oct 26 17:40:31 2016 -0400

    start to add html parsing
2016-11-16 13:12:36 -05:00
Cassie Tarakajian
2750b1f0ef #189 i have literally been putting this off for months but i finally figured out now to resolve file paths \ 😄 / 2016-11-08 16:50:21 -05:00
Cassie Tarakajian
dfc55aaa5b temporarily remote autorefresh and loop protect 2016-10-04 15:35:23 -04:00
Cassie Tarakajian
1232e4c5ca add db reformat script 2016-10-01 14:01:32 -04:00
catarak
e24e2805b6 db reformat 2016-09-14 17:34:10 -04:00
catarak
7436f4960f this time, db reformat, for real 2016-09-14 16:41:36 -04:00
catarak
03e2fd32c5 more db testing stuff 2016-09-14 16:33:47 -04:00