Commit graph

11 commits

Author SHA1 Message Date
Andrew Nicolaou
0b5180d26c Configure CORS localhost origin via CORS_ALLOW_LOCALHOST env var 2020-05-03 13:20:14 +02:00
Cassie Tarakajian
0e0140a592 Add upload limit to .env.example 2020-03-30 16:06:57 -04:00
Andrew Nicolaou
162d5276f1 Display Access Token tab depending on UI_ACCESS_TOKEN_ENABLED feature flag (#1149) 2019-08-30 16:15:13 -04:00
Andrew Nicolaou
1f4bd581a8 Public API: Namespace private and public APIs (#1148)
* 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.

* Splits private and public APIs

The private API is under /editor and the public API under /api
2019-08-30 14:39:45 -04:00
Joey Lee
a5753b5e4c Script to fetch ml5 examples from Github Repo (#1051)
* replaced () with {} to fix implicit return error

* added first version of fetching generative-design examples

* ignore local testing files

* formatting

* updated examples-gg-latest

* updated examples-gg-latest.js

- data files not served via rawgit - hallelujah!
- added jquery

* updated p5 version

* refactoring and code cleanup

* added comment

* comment out link to svgFiles - unused

* moved commented code

* fixed conflicts

* linted examples-gg-latest

* removed console.log of response.data to prevent logging user data to console

* fixed linting error

* initial commit for setting up automated ml5 example fetching

* rm logs from .env replaced with placeholder

* added functions for retrieving all assets from examples sketches

* added recursive walk through to get all directories and files

* added functions t format files for making project

* added full working test

* added comments and formated code

* added comments

* set username at to of code

* added process.exit() on complete

* added linting and fixed errors

* rm await in return

* added es lint disable for reduce()

* rm package-lock.json

* reset package-lock.json to master

* "updated .env.example with dummy logins"

* updated .env.example for consistency

* added p5 user checking

* fixed linting issues

* add webpack config to build ml5 example fetching bundle
2019-05-02 15:12:06 -04:00
Francis Li
1edbb52f4d Rebase/squash 2018-12-09 15:34:15 -08:00
Cassie Tarakajian
8495a59e36
Development documentation (#705)
* delete unused files, move webpack configs to their own directory

* start of improved developer documentation, moving everything to developer_docs/ directory

* documentation updates
2018-09-26 16:14:06 -04:00
Cassie Tarakajian
f06198a4e1 start to add mongo configuration 2018-06-25 16:13:31 -07:00
Cassie Tarakajian
0857a52326 update .env.example and README, start to build out Docker development and prodiction setup 2018-06-18 14:32:08 -07:00
Jared Donovan
c814826c4a Remove EXAMPLE_USERNAME as a settable option as per discussion on Issue #646 (#651) 2018-06-18 14:30:05 -07:00
Liang Tang
824d2d55aa add example env file (#623) 2018-05-08 12:29:29 -07:00