Compare commits
141 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42050dc078 | ||
|
|
ffe74eafcd | ||
|
|
10db1541c2 | ||
|
|
2a9ef35ef2 | ||
|
|
405fb04ce6 | ||
|
|
a7d64bac79 | ||
|
|
ee962f9afa | ||
|
|
bef2eb7344 | ||
|
|
ed3d0e7392 | ||
|
|
deb81d2164 | ||
|
|
b6c651e47f | ||
|
|
9887d1a898 | ||
|
|
701f43c98f | ||
|
|
912be0bc38 | ||
|
|
9c58d92aee | ||
|
|
2cd3bd0e1d | ||
|
|
13ceb1fe52 | ||
|
|
6c34e65c3b | ||
|
|
17ce7328bb | ||
|
|
30de61172a | ||
|
|
d3ec553b33 | ||
|
|
4537b35c6b | ||
|
|
3ad5c4e86b | ||
|
|
2e47aaf645 | ||
|
|
5ac5d3a6be | ||
|
|
8de3d59d04 | ||
|
|
bf575badb0 | ||
|
|
3fcde897b7 | ||
|
|
52ddbc72f7 | ||
|
|
1866b3054c | ||
|
|
4eb162b8e0 | ||
|
|
feff3056a5 | ||
|
|
e05c36c26a | ||
|
|
596999193a | ||
|
|
d71bd22924 | ||
|
|
a4454fa6ad | ||
|
|
861b6aa951 | ||
|
|
5414f3b371 | ||
|
|
46760ae135 | ||
|
|
fa11cb1214 | ||
|
|
97441902a6 | ||
|
|
6ef9b8e52c | ||
|
|
27682231b7 | ||
|
|
ca5e5a7714 | ||
|
|
adafe06c11 | ||
|
|
17c09b0853 | ||
|
|
9ee877f3e6 | ||
|
|
46816290fc | ||
|
|
79e25a6d52 | ||
|
|
e4a9088014 | ||
|
|
7b4b772acc | ||
|
|
04dd4abb77 | ||
|
|
4387f48dc8 | ||
|
|
6e1f2b7edb | ||
|
|
6e7194d64b | ||
|
|
59d59eb048 | ||
|
|
034da458be | ||
|
|
c6360ce3be | ||
|
|
d67a780185 | ||
|
|
b36a73afdb | ||
|
|
97af16862a | ||
|
|
961ff38eb5 | ||
|
|
4d27b928d8 | ||
|
|
e72dcbda9f | ||
|
|
5be5edcc71 | ||
|
|
17908af385 | ||
|
|
0ea7aa9bf3 | ||
|
|
b3d7f26b41 | ||
|
|
40da6a3c3a | ||
|
|
558306ed6b | ||
|
|
411c2c2987 | ||
|
|
0fe0ea3489 | ||
|
|
8501b26511 | ||
|
|
a9fbe35fae | ||
|
|
8616f69ff6 | ||
|
|
f5e31b78aa | ||
|
|
4927124913 | ||
|
|
6f7be0dec9 | ||
|
|
5b5af35363 | ||
|
|
3d6aca7371 | ||
|
|
3788f03363 | ||
|
|
1ad35869cc | ||
|
|
f709a43f73 | ||
|
|
8cb5376517 | ||
|
|
2f8a6f5cbf | ||
|
|
a176a50ff2 | ||
|
|
1ec3879ba4 | ||
|
|
c0ef337a3d | ||
|
|
d3f463d801 | ||
|
|
b253917350 | ||
|
|
c38b4dcecc | ||
|
|
d2dc2ef055 | ||
|
|
8c915ab083 | ||
|
|
b913d67327 | ||
|
|
5718a4f147 | ||
|
|
2742bbd445 | ||
|
|
0a9d629e31 | ||
|
|
8f1e926f31 | ||
|
|
b691233be4 | ||
|
|
2c0f2795cb | ||
|
|
2e9ab53f0a | ||
|
|
8fab0c2c9f | ||
|
|
e7208ea992 | ||
|
|
88f8b7d828 | ||
|
|
a63603b530 | ||
|
|
7e7696b8cc | ||
|
|
79246e1792 | ||
|
|
67468a0c8c | ||
|
|
d7e8474275 | ||
|
|
e9fce972a3 | ||
|
|
3e72a094f1 | ||
|
|
2db7403e13 | ||
|
|
66c7e831f9 | ||
|
|
d01fa8b447 | ||
|
|
fbc1433338 | ||
|
|
57aadf1457 | ||
|
|
769fb9f084 | ||
|
|
d06875cdd3 | ||
|
|
857e90680c | ||
|
|
7a0154479f | ||
|
|
190b9fb4b9 | ||
|
|
991afad42a | ||
|
|
cd5c864520 | ||
|
|
6fbda81fc2 | ||
|
|
c48ef4adca | ||
|
|
2e5184c0db | ||
|
|
44f5d688e9 | ||
|
|
59c526a02c | ||
|
|
9e34fa9c50 | ||
|
|
820b24886d | ||
|
|
6ab6992896 | ||
|
|
60bfb27aee | ||
|
|
61bd605c77 | ||
|
|
9fb70fc3c3 | ||
|
|
6d793c32ea | ||
|
|
c4bbe74b1a | ||
|
|
42400cafa7 | ||
|
|
aee4781083 | ||
|
|
c159943d97 | ||
|
|
e9415784cc | ||
|
|
6bfa3ac728 |
@ -1,104 +0,0 @@
|
||||
{
|
||||
"projectName": "OhMyForm",
|
||||
"projectOwner": "ohmyform",
|
||||
"files": [
|
||||
"README.md"
|
||||
],
|
||||
"imageSize": 100,
|
||||
"commit": true,
|
||||
"contributors": [
|
||||
{
|
||||
"login": "whitef0x0",
|
||||
"name": "David Baldwynn",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/1160417?v=3",
|
||||
"profile": "http://baldwynn.me",
|
||||
"contributions": [
|
||||
"code",
|
||||
"tool",
|
||||
"infra",
|
||||
"doc",
|
||||
"example",
|
||||
"design",
|
||||
"fundingFinding",
|
||||
"review",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "lalop",
|
||||
"name": "Samuel Laulhau",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/313117?v=3",
|
||||
"profile": "https://samuellaulhau.fr",
|
||||
"contributions": [
|
||||
"code",
|
||||
"translation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "arunpattnaik",
|
||||
"name": "Arun Pattnaik",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/313507?v=3",
|
||||
"profile": "http://arun.co",
|
||||
"contributions": [
|
||||
"design"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "toanalien",
|
||||
"name": "Thiên Toán",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/5405744?v=3",
|
||||
"profile": "https://toanalien.com",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "AdrianP-",
|
||||
"name": "Adrian Portabales",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/8615608?v=3",
|
||||
"profile": "https://github.com/AdrianP-",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "spekulatius",
|
||||
"name": "Peter Thaleikis",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/8433587?v=3",
|
||||
"profile": "https://github.com/spekulatius",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "mickaelandrieu",
|
||||
"name": "Mickaël Andrieu",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1247388?v=3",
|
||||
"profile": "http://www.mickael-andrieu.com",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ahmad-luqman",
|
||||
"name": "Ahmad Luqman",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/1522464?v=3",
|
||||
"profile": "https://github.com/ahmad-luqman",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "PeterDaveHello",
|
||||
"name": "Peter Dave Hello",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/3691490?v=3",
|
||||
"profile": "https://www.peterdavehello.org/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
5
.bowerrc
5
.bowerrc
@ -1,5 +0,0 @@
|
||||
{
|
||||
"directory": "public/lib",
|
||||
"analytics": false,
|
||||
"registry": "https://registry.bower.io"
|
||||
}
|
||||
15
.csslintrc
15
.csslintrc
@ -1,15 +0,0 @@
|
||||
{
|
||||
"adjoining-classes": false,
|
||||
"box-model": false,
|
||||
"box-sizing": false,
|
||||
"floats": false,
|
||||
"font-sizes": false,
|
||||
"important": false,
|
||||
"known-properties": false,
|
||||
"overqualified-elements": false,
|
||||
"qualified-headings": false,
|
||||
"regex-selectors": false,
|
||||
"unique-headings": false,
|
||||
"universal-selector": false,
|
||||
"unqualified-attributes": false
|
||||
}
|
||||
@ -5,6 +5,7 @@ data
|
||||
docker
|
||||
node_modules
|
||||
selenium
|
||||
examples
|
||||
.all-contributorsrc
|
||||
.csslintrc
|
||||
.editorconfig
|
||||
@ -18,3 +19,11 @@ docker-compose.yml
|
||||
Dockerfile
|
||||
Procfile
|
||||
protractor.conf.js
|
||||
pg_data
|
||||
ui/.next
|
||||
ui/node_modules
|
||||
api/node_modules
|
||||
api/pg_data
|
||||
api/data
|
||||
api/maria_data
|
||||
api/dist
|
||||
@ -1,25 +0,0 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# How-to with your editor: http://editorconfig.org/#download
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
|
||||
[{Dockerfile,Procfile}]
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Standard at: https://github.com/felixge/node-style-guide
|
||||
[{*.js,*.json}]
|
||||
trim_trailing_whitespace = true
|
||||
quote_type = single
|
||||
curly_bracket_next_line = false
|
||||
spaces_around_operators = true
|
||||
space_after_control_statements = true
|
||||
space_after_anonymous_functions = false
|
||||
spaces_in_brackets = false
|
||||
125
.env.example
125
.env.example
@ -1,125 +0,0 @@
|
||||
# OhMyForm Configuration File
|
||||
## TODO: Have commented out examples that would work.
|
||||
|
||||
###################################
|
||||
# Common configuration variables
|
||||
###################################
|
||||
|
||||
# Set this to the path where Mailu data and configuration is stored
|
||||
# Mac users: Change to a Docker accessible folder
|
||||
ROOT=/opt/ohmyform_data
|
||||
|
||||
# Set to what environment you will be running OhMyForm in (production or development)
|
||||
NODE_ENV=development
|
||||
|
||||
# Set to a randomly generated 16 bytes string
|
||||
SECRET_KEY=ChangeMeChangeMe
|
||||
|
||||
# URI of Mongo database that OhMyForm will connect to
|
||||
#DO NOT CHANGE
|
||||
MONGODB_URI=mongodb://mongo/ohmyform
|
||||
|
||||
# URL Redis server that OhMyForm will connect to
|
||||
#DO NOT CHANGE
|
||||
REDIS_URL=redis://redis:6379
|
||||
|
||||
# Port that the OhMyForm Node app will listen on
|
||||
PORT=5000
|
||||
|
||||
# Domain that OhMyForm's admin panel will be hosted at
|
||||
BASE_URL=ohmyform.dev
|
||||
|
||||
# Port that SocketIO server (for analytics) will listen on
|
||||
SOCKET_PORT=20523
|
||||
|
||||
#Choose what kind of TLS you want.
|
||||
#Can be either 'cert' (supply your certificates in ./cert/), 'notls' (no https at all) or 'letsencrypt' that autoconfigures your instance with letsencrypt
|
||||
TLS_FLAVOR=notls
|
||||
|
||||
###################################
|
||||
# Optional features
|
||||
###################################
|
||||
|
||||
# Set this to enable coveralls.io support
|
||||
COVERALLS_REPO_TOKEN=
|
||||
|
||||
# Disable signups for your OhMyForm instance
|
||||
SIGNUP_DISABLED=FALSE
|
||||
|
||||
# Disable per-user custom subdomains
|
||||
SUBDOMAINS_DISABLED=FALSE
|
||||
|
||||
# Url that subdomains will be hosted at (has to have domain name as ADMIN_URL)
|
||||
# Only used when SUBDOMAINS_DISABLED=FALSE
|
||||
SUBDOMAIN_URL=*.ohmyform.dev
|
||||
|
||||
# Enable running OhMyForm in pm2's 'cluster' mode
|
||||
ENABLE_CLUSTER_MODE=FALSE
|
||||
|
||||
###################################
|
||||
# Mail settings
|
||||
# IMPORTANT: These settings need to be set
|
||||
# to be set in order for your instance to work
|
||||
###################################
|
||||
|
||||
|
||||
|
||||
# Set this to set the username credential of your SMTP service
|
||||
MAILER_EMAIL_ID=
|
||||
|
||||
# Set this to set the password credential of your SMTP service
|
||||
MAILER_PASSWORD=
|
||||
|
||||
# Set this to set the email address that all email should be sent from for signup/verification emails
|
||||
MAILER_FROM=
|
||||
|
||||
# Set this to any services from https://nodemailer.com/smtp/well-known/ to use a 'well-known' email provider
|
||||
MAILER_SERVICE_PROVIDER=
|
||||
|
||||
# Set these if you are not using a 'MAILER_SERVICE_PROVIDER' and want to specify your SMTP server's address and port
|
||||
MAILER_SMTP_HOST=
|
||||
MAILER_SMTP_PORT=
|
||||
|
||||
# Set this if you are using a custom SMTP server that supports SSL
|
||||
MAILER_SMTP_SECURE
|
||||
|
||||
###################################
|
||||
# Automatic Admin Creation Settings
|
||||
###################################
|
||||
|
||||
# Set this to "TRUE" if you wish to automatically create an admin user on startup
|
||||
CREATE_ADMIN=FALSE
|
||||
|
||||
# Set this to set the email used by your default admin account
|
||||
ADMIN_EMAIL=admin@admin.com
|
||||
|
||||
# Set this to set the username of your default admin acconut
|
||||
ADMIN_USERNAME=root
|
||||
|
||||
# Set this to set the password of your default admin account
|
||||
ADMIN_PASSWORD=root
|
||||
|
||||
###################################
|
||||
# Advanced settings
|
||||
###################################
|
||||
|
||||
# Set this to server your websockets server on a seperate URL
|
||||
SOCKETS_URL=
|
||||
|
||||
# Set this to change the port that OhMyForm will listen on
|
||||
PORT=5000
|
||||
|
||||
# Set this to your Google Analytics ID to enable tracking with GA
|
||||
GOOGLE_ANALYTICS_ID=
|
||||
|
||||
# Set this to your Sentry.io DSN code to enable front-end JS error tracking with Sentry.io
|
||||
RAVEN_DSN
|
||||
|
||||
# Set this to set the 'name' meta property in the HTML <head>
|
||||
APP_NAME=
|
||||
|
||||
# Set this to set the 'keywords' meta property in the HTML <head>
|
||||
APP_KEYWORDS=
|
||||
|
||||
# Set this to set the 'description' meta property in the HTML head
|
||||
APP_DESC=
|
||||
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
# github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
# patreon: # Replace with a single Patreon username
|
||||
open_collective: ohmyform-sustainability
|
||||
# ko_fi: # Replace with a single Ko-fi username
|
||||
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
# liberapay: Leopere
|
||||
# issuehunt: # Replace with a single IssueHunt username
|
||||
# otechie: # Replace with a single Otechie username
|
||||
# custom: https://patron.ohmyform.com
|
||||
45
.github/workflows/docker-image.yml
vendored
Normal file
45
.github/workflows/docker-image.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Push Docker image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ohmyform/ohmyform
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=semver,pattern={{major}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{version}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -61,6 +61,9 @@ local.properties
|
||||
.c9/
|
||||
data/
|
||||
mongod
|
||||
pg_data
|
||||
maria
|
||||
*.sqlite
|
||||
|
||||
# General
|
||||
# =======
|
||||
|
||||
7
.gitmodules
vendored
Normal file
7
.gitmodules
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
[submodule "ui"]
|
||||
path = ui
|
||||
url = https://github.com/ohmyform/ui
|
||||
|
||||
[submodule "api"]
|
||||
path = api
|
||||
url = https://github.com/ohmyform/api
|
||||
54
.jshintrc
54
.jshintrc
@ -1,54 +0,0 @@
|
||||
{
|
||||
"loopfunc": true,
|
||||
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
|
||||
"browser": true, // Standard browser globals e.g. `window`, `document`.
|
||||
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
|
||||
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
|
||||
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
|
||||
"curly": false, // Require {} for every new block or scope.
|
||||
"eqeqeq": true, // Require triple equals i.e. `===`.
|
||||
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
|
||||
"latedef": false, // Prohibit variable use before definition.
|
||||
"newcap": false, // Require capitalization of all constructor functions e.g. `new F()`.
|
||||
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
|
||||
"quotmark": "single", // Define quotes to string values.
|
||||
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
|
||||
"undef": true, // Require all non-global variables be declared before they are used.
|
||||
"unused": false, // Warn unused variables.
|
||||
"strict": true, // Require `use strict` pragma in every file.
|
||||
"trailing": true, // Prohibit trailing whitespaces.
|
||||
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
|
||||
"globals": { // Globals variables.
|
||||
"jasmine": true,
|
||||
"angular": true,
|
||||
"devel": false,
|
||||
"_": true,
|
||||
"saveAs": true,
|
||||
"ApplicationConfiguration": true,
|
||||
"Session": true,
|
||||
"$": true,
|
||||
"$window": true,
|
||||
"io": true,
|
||||
"jsep": true,
|
||||
"MobileDetect": true
|
||||
},
|
||||
"predef": [ // Extra globals.
|
||||
"define",
|
||||
"require",
|
||||
"exports",
|
||||
"module",
|
||||
"describe",
|
||||
"before",
|
||||
"beforeEach",
|
||||
"after",
|
||||
"afterEach",
|
||||
"it",
|
||||
"inject",
|
||||
"expect",
|
||||
"_",
|
||||
"spyOn"
|
||||
],
|
||||
"indent": 4, // Specify indentation spacing
|
||||
"devel": true, // Allow development statements e.g. `console.log();`.
|
||||
"noempty": true // Prohibit use of empty blocks.
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
/app/tests
|
||||
228
CHANGELOG.md
Normal file
228
CHANGELOG.md
Normal file
@ -0,0 +1,228 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
<!--
|
||||
Template for next version
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
-->
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed typo https://github.com/ohmyform/ohmyform/pull/185
|
||||
* node prune location (https://github.com/ohmyform/ohmyform/issues/184)
|
||||
|
||||
### Security
|
||||
|
||||
## [1.0.3] - 2022-03-27
|
||||
|
||||
### Updates
|
||||
|
||||
* https://github.com/ohmyform/api/releases/tag/1.0.3
|
||||
* https://github.com/ohmyform/ui/releases/tag/1.0.3
|
||||
|
||||
### Added
|
||||
|
||||
* minimal configuration example for caddy server (https://github.com/ohmyform/ohmyform/pull/167)
|
||||
|
||||
## [1.0.2] - 2022-03-13
|
||||
|
||||
### Updates
|
||||
|
||||
* https://github.com/ohmyform/api/releases/tag/1.0.2
|
||||
* https://github.com/ohmyform/ui/releases/tag/1.0.2
|
||||
|
||||
### Changed
|
||||
|
||||
- docker restart policy (https://github.com/ohmyform/ohmyform/issues/164)
|
||||
|
||||
## [1.0.1] - 2022-03-01
|
||||
|
||||
### Updates
|
||||
|
||||
* https://github.com/ohmyform/api/releases/tag/1.0.1
|
||||
* https://github.com/ohmyform/ui/releases/tag/1.0.1
|
||||
|
||||
## [1.0.0] - 2022-02-28
|
||||
|
||||
### Updates
|
||||
|
||||
* https://github.com/ohmyform/api/releases/tag/1.0.0
|
||||
* https://github.com/ohmyform/ui/releases/tag/1.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
- switched to supervisord based combined container
|
||||
- upgrade to node 16
|
||||
|
||||
### Fixed
|
||||
|
||||
- heroku deployments
|
||||
- fix problem with node-prune on production build
|
||||
- variable names in examples (https://github.com/ohmyform/ohmyform/issues/134)
|
||||
- error if /run/nginx already exists (https://github.com/ohmyform/ohmyform/pull/148)
|
||||
- fix combine images
|
||||
|
||||
## [0.9.9] - 2021-02-14
|
||||
|
||||
### Added
|
||||
|
||||
- Submission export
|
||||
- Lokalize reference
|
||||
- more languages
|
||||
|
||||
### Changed
|
||||
|
||||
- updated french translations by @Vercety87
|
||||
- upgrade to node 14 (https://github.com/ohmyform/ohmyform/issues/99)
|
||||
|
||||
### Fixed
|
||||
|
||||
- missing dependency to @apollo/client
|
||||
- footer rendering during authentication check
|
||||
|
||||
### Security
|
||||
|
||||
- authentication check for profile page
|
||||
|
||||
## [0.9.8] - 2020-09-02
|
||||
|
||||
### Changed
|
||||
|
||||
- improved german translation (https://github.com/ohmyform/ui/pull/28)
|
||||
|
||||
### Fixed
|
||||
|
||||
- colors for landing page buttons
|
||||
- menu selection type
|
||||
|
||||
### Security
|
||||
|
||||
- upgraded dependencies
|
||||
|
||||
## [0.9.6] - 2020-07-17
|
||||
|
||||
### Added
|
||||
|
||||
- slug for fields to be able to set value by url parameter
|
||||
- form submission hokks
|
||||
- default index.html for api without bundled ui
|
||||
- slug for form fields can now be saved
|
||||
- submission webhooks with ability to customize json payload
|
||||
```
|
||||
{
|
||||
form: ID
|
||||
submission: ID
|
||||
created: DateTime
|
||||
lastModified: DateTime
|
||||
fields: [
|
||||
{
|
||||
field: ID
|
||||
slug: String
|
||||
value: any
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Changed
|
||||
|
||||
- minify containers to reduce layer size
|
||||
|
||||
### Fixed
|
||||
|
||||
- bug in settings resolver with nullable fields
|
||||
- bug if user was deleted and form still exists
|
||||
- do not show login note if it is not set
|
||||
- typo in dropdown options https://github.com/ohmyform/ohmyform/issues/96
|
||||
- query parms are not parsed https://github.com/ohmyform/ui/pull/27 https://github.com/ohmyform/ohmyform/issues/100
|
||||
- errors because of missing user reference (https://github.com/ohmyform/ohmyform/issues/102)
|
||||
|
||||
### Security
|
||||
|
||||
- container now runs as non root user
|
||||
|
||||
## [0.9.5] - 2020-06-10
|
||||
|
||||
### Added
|
||||
|
||||
- `DEFAULT_ROLE` -> `admin` | `superuser` | `user` - with `user` being the default, making it possible that new users can create their own forms after creating
|
||||
- `LOGIN_NOTE` -> markdown for Login Page, to show info text on login page
|
||||
- `HIDE_CONTRIB` -> ability to hide contribution banner
|
||||
- mobile improvements for lists and home page
|
||||
- markdown support for page paragraphs and field description
|
||||
- hideable omf badge
|
||||
- login notes
|
||||
- username in admin toolbar
|
||||
- github stars in multiple places
|
||||
|
||||
### Changed
|
||||
|
||||
- verified spanish translations https://github.com/ohmyform/ui/pull/23
|
||||
|
||||
### Fixed
|
||||
|
||||
- di on setting resolver, prevented signup settings to be visible in ui
|
||||
- return admin of form also for admins
|
||||
- yes / no field fixed on admin and user view
|
||||
- prev property error on div
|
||||
- rating field default on admin
|
||||
- number field defaults
|
||||
- translations for field validation
|
||||
- number validation
|
||||
- side menu only shows accessible entries
|
||||
|
||||
## [0.9.4] - 2020-06-09
|
||||
|
||||
### Added
|
||||
|
||||
- Fetch Server Settings to determine if signup is available
|
||||
- `SPA` env variable to have static page with loading spinner before redirect
|
||||
- `de`, `fr`, `es`, `it`, `cn` base folders for translations
|
||||
- finish translating `de` and `en`
|
||||
- add `yarn translation:sort` to order translations (to ensure the same order
|
||||
when we add / change translations)
|
||||
- add `yarn translation:missing <lang>` to print a list of missing translations
|
||||
for the given language (this takes `en` as a baseline)
|
||||
- travis for tests
|
||||
- eslint with prettier
|
||||
- `SIGNUP_DISABLED=true` to prevent users from signing up
|
||||
|
||||
### Changed
|
||||
|
||||
- `export` uses now spa mode for initial loading screen
|
||||
|
||||
### Fixed
|
||||
|
||||
- [OMF#93](https://github.com/ohmyform/ohmyform/issues/93) dropdown options are not saved
|
||||
- redirect attempts on static export
|
||||
- startup error with invalid create admin config
|
||||
|
||||
## [0.9.3] - 2020-06-04
|
||||
|
||||
### Added
|
||||
|
||||
- nginx example
|
||||
- load balanced example
|
||||
- minimal example
|
||||
|
||||
### Fixed
|
||||
|
||||
- docker-compose mongo data dir to persist data
|
||||
40
CONTRIBUTING.md
Executable file
40
CONTRIBUTING.md
Executable file
@ -0,0 +1,40 @@
|
||||
# Contributing
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
|
||||
|
||||
- [Contributing](#contributing)
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [Report issues](#report-issues)
|
||||
- [Write code](#write-code)
|
||||
- [Clone the project](#clone-the-project)
|
||||
- [Run the server locally](#run-the-server-locally)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
## Translating
|
||||
|
||||
You can help us [translate](https://app.lokalise.com/public/379418475ede5d5c6937b0.31012044/) ever part of OhMyForm, when you want to add a new language please write either in discord or create a new issue.
|
||||
|
||||
## Report issues
|
||||
|
||||
You can [create issues](https://github.com/ohmyform/ohmyform/issues/new) to report bug or request feature.
|
||||
|
||||
## Write code
|
||||
|
||||
Here is how to setup your development environment:
|
||||
|
||||
### Clone the project
|
||||
|
||||
```
|
||||
$ git clone https://github.com/ohmyform/ohmyform
|
||||
```
|
||||
|
||||
### Run the server locally
|
||||
|
||||
```
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
You should have at this point have a working instance to play with at <http://localhost:5000> within moments.
|
||||
103
Dockerfile
103
Dockerfile
@ -1,52 +1,73 @@
|
||||
FROM node:10-alpine
|
||||
MAINTAINER OhMyForm <admin@ohmyform.com>
|
||||
## Build UI
|
||||
FROM node:16-alpine as ui
|
||||
|
||||
# Install some needed packages
|
||||
RUN apk add --no-cache git \
|
||||
&& rm -rf /tmp/* \
|
||||
&& npm install --quiet -g grunt bower pm2 \
|
||||
&& npm cache clean --force \
|
||||
&& mkdir -p /opt/app/public/lib
|
||||
WORKDIR /usr/src/ui
|
||||
|
||||
# to expose the public folder to other containers
|
||||
# VOLUME /opt/app
|
||||
RUN apk --update --no-cache add curl bash g++ make libpng-dev
|
||||
|
||||
WORKDIR /opt/app
|
||||
# install node-prune (https://github.com/tj/node-prune)
|
||||
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
||||
|
||||
## TODO: Find a method that's better than this for passing ENV's if possible.
|
||||
# Set default ENV
|
||||
ENV NODE_ENV=development \
|
||||
SECRET_KEY=ChangeMeChangeMe \
|
||||
PORT=5000 \
|
||||
BASE_URL=localhost \
|
||||
SOCKET_PORT=20523 \
|
||||
SIGNUP_DISABLED=FALSE \
|
||||
SUBDOMAINS_DISABLED=TRUE \
|
||||
ENABLE_CLUSTER_MODE=FALSE \
|
||||
MAILER_EMAIL_ID=ohmyform@localhost \
|
||||
MAILER_PASSWORD="" \
|
||||
MAILER_FROM=ohmyform@localhost \
|
||||
MAILER_SERVICE_PROVIDER="" \
|
||||
MAILER_SMTP_HOST="" \
|
||||
MAILER_SMTP_PORT="" \
|
||||
MAILER_SMTP_SECURE="" \
|
||||
COPY ui/ .
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn build
|
||||
|
||||
# remove development dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
# run node prune
|
||||
# there is some problem running node prune that then prevents the frontend to load (just start with /form/1 and it will crash)
|
||||
#RUN /usr/local/bin/node-prune
|
||||
|
||||
## Build API
|
||||
FROM node:16-alpine as api
|
||||
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
|
||||
|
||||
WORKDIR /usr/src/api
|
||||
|
||||
RUN apk --update --no-cache add curl bash g++ make libpng-dev
|
||||
|
||||
# install node-prune (https://github.com/tj/node-prune)
|
||||
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
||||
|
||||
COPY api/ .
|
||||
|
||||
RUN touch /usr/src/api/src/schema.gql && chown 9999:9999 /usr/src/api/src/schema.gql
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn build
|
||||
|
||||
# remove development dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
# run node prune
|
||||
RUN /usr/local/bin/node-prune
|
||||
|
||||
## Production Image.
|
||||
FROM node:16-alpine
|
||||
|
||||
RUN apk --update add supervisor nginx && rm -rf /var/cache/apk/*
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
COPY --from=api /usr/src/api /usr/src/api
|
||||
COPY --from=ui /usr/src/ui /usr/src/ui
|
||||
|
||||
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
|
||||
ENV SECRET_KEY=ChangeMe \
|
||||
CREATE_ADMIN=FALSE \
|
||||
ADMIN_EMAIL=admin@ohmyform.com \
|
||||
ADMIN_USERNAME=root \
|
||||
ADMIN_PASSWORD=root \
|
||||
APP_NAME=OhMyForm \
|
||||
APP_KEYWORDS="" \
|
||||
APP_DESC="" \
|
||||
COVERALLS_REPO_TOKEN="" \
|
||||
GOOGLE_ANALYTICS_ID="" \
|
||||
RAVEN_DSN=""
|
||||
NODE_ENV=production
|
||||
|
||||
# keep .dockerignore up to date
|
||||
COPY . .
|
||||
EXPOSE 3000
|
||||
|
||||
RUN npm install --only=production \
|
||||
&& bower install --allow-root -f \
|
||||
&& grunt build
|
||||
RUN mkdir -p /run/nginx/
|
||||
RUN touch /usr/src/supervisord.log && chmod 777 /usr/src/supervisord.log
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Run OhMyForm server
|
||||
CMD ["node", "server.js"]
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
# CMD [ "yarn", "start:prod" ]
|
||||
|
||||
676
LICENSE.md
676
LICENSE.md
@ -1,21 +1,661 @@
|
||||
## License
|
||||
(The MIT License)
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
Preamble
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
2
Procfile
2
Procfile
@ -1 +1 @@
|
||||
web: ./node_modules/.bin/forever -m 5 server.js
|
||||
web: node api/dist/main
|
||||
|
||||
100
README.md
100
README.md
@ -1,32 +1,30 @@
|
||||
# OhMyForm 0.2.1
|
||||

|
||||
|
||||
# OhMyForm
|
||||
|
||||
<!-- TODO: Code Shelter maybe. -->
|
||||
<!-- [](https://www.codeshelter.co/) -->
|
||||
<!-- TODO: Travis CI maybe. -->
|
||||
<!-- [](https://travis-ci.org/ohmyform/ohmyform) -->
|
||||

|
||||
<!-- TODO: Codeacy maybe. -->
|
||||
<!-- [](https://www.codacy.com/app/david-baldwin/ohmyform?utm_source=github.com&utm_medium=referral&utm_content=ohmyform/ohmyform&utm_campaign=Badge_Grade) -->
|
||||
<!--
|
||||
Moving over to Discord so that I can manage things without hassle.
|
||||
[](https://gitter.im/ohmyform/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
-->
|
||||
<!-- TODO: Get ohmyform.com/examples to have some. -->
|
||||
[](https://discord.gg/3jYMAYg)
|
||||
> An *open source alternative to TypeForm* that can create [stunning mobile-ready forms](https://ohmyform.com/examples) , surveys and questionnaires.
|
||||

|
||||

|
||||
[](https://hub.docker.com/r/ohmyform/ohmyform)
|
||||
[](https://app.lokalise.com/public/379418475ede5d5c6937b0.31012044/)
|
||||

|
||||
|
||||
<!-- [](https://heroku.com/deploy?template=https://github.com/ohmyform/ohmyform/tree/production)-->
|
||||
[](https://heroku.com/deploy?template=https://github.com/ohmyform/ohmyform/tree/master)
|
||||
|
||||
[Demo](https://demo.ohmyform.org/) Username and password are just `demo`. We will reset the demo instance at least once for every new release and possibly more often so don't rely on it for sending actual forms expect no notice for resets.
|
||||
|
||||
> An *open source alternative to TypeForm* that can create stunning mobile-ready forms, surveys and questionnaires.
|
||||
|
||||
[](https://discord.gg/MJqAuAZ)
|
||||
[](https://opencollective.com/ohmyform-sustainability)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
|
||||
|
||||
- [OhMyForm 0.2.1](#ohmyform-021)
|
||||
- [OhMyForm](#ohmyform-091)
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [Features](#features)
|
||||
- [Currently following features are implemented:](#currently-following-features-are-implemented)
|
||||
- [On the Roadmap for v1.0.0](#on-the-roadmap-for-v100)
|
||||
- [On the Roadmap](#on-the-roadmap)
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
- [Quickstart](#quickstart)
|
||||
- [Where to get help](#where-to-get-help)
|
||||
@ -35,41 +33,81 @@ Moving over to Discord so that I can manage things without hassle.
|
||||
|
||||
## Features
|
||||
|
||||
### Currently following features are implemented:
|
||||
|
||||
- Multi-Language Support (Semi implemented)
|
||||
- Multi-Language Support
|
||||
- 11 possible question types
|
||||
- Editable start and end pages
|
||||
- Export Submissions to XLS, JSON or CSV
|
||||
- Native Analytics and Google Analytics Support
|
||||
- Custom Subdomains for each User
|
||||
- Embeddable Forms
|
||||
- Forms as a Service API
|
||||
- Customizable Notifications on Form Submission
|
||||
- Web Hooks on Form Submission
|
||||
- Deployable with Heroku and DockerHub
|
||||
- PostgreSQL and sqlite
|
||||
|
||||
<!-- TODO: Determine roadmap for OhMyForm if it is to be different from OhMyForm's roadmap.
|
||||
### On the Roadmap (Tentative pending [refactor](https://github.com/ohmyform/ohmyform/pull/1))
|
||||
<!-- TODO: Determine roadmap for OhMyForm if it is to be different from OhMyForm's roadmap. -->
|
||||
<!-- ### On the Roadmap (Tentative pending [refactor](https://github.com/ohmyform/ohmyform/pull/1)) -->
|
||||
|
||||
### On the Roadmap
|
||||
- Custom Subdomains for each User
|
||||
- Implement encryption for all form data
|
||||
- Add Typeform API integration
|
||||
- Add plugin/3rd party integration support (ala Slack)
|
||||
- Add plugin/3rd party integration support (aka Slack)
|
||||
- Create wiki for easy installation and setup
|
||||
- Add Stripe/Payment Form field
|
||||
- Add Custom Background and Dropdown Field Images
|
||||
- Add File Upload Form Field
|
||||
- Deployable with Heroku and DockerHub
|
||||
-->
|
||||
|
||||
|
||||
<!-- TODO: add a CONTRIBUTING.md.
|
||||
|
||||
<!-- TODO: add a CONTRIBUTING.md. -->
|
||||
## How to Contribute
|
||||
|
||||
Please checkout our CONTRIBUTING.md on ways to contribute to OhMyForm. -->
|
||||
Please checkout our [contributing guide](CONTRIBUTING.md) on ways to contribute to OhMyForm.
|
||||
|
||||
## Quickstart
|
||||
|
||||
Follow documentation hosted on [OhMyForm.com](http://ohmyform.com/docs/install/) it will be the main and hopefully only location to obtain the up to date documentation.
|
||||
|
||||
If you pull the repository do not forget to execute: `git submodule update --init`
|
||||
|
||||
### Some technical Insights
|
||||
|
||||
[API](https://github.com/ohmyform/api/tree/master/doc)
|
||||
|
||||
[UI](https://github.com/ohmyform/ui/tree/master/doc)
|
||||
|
||||
## Where to get help
|
||||
|
||||
[](https://discord.gg/Y2TTePM)
|
||||
|
||||
<!-- TODO: Figure out how to generate that contributors table. -->
|
||||
## Alternative Social
|
||||
[Twitter](https://twitter.com/OhMyForm)
|
||||
[Instagram](https://www.instagram.com/ohmyform/)
|
||||
|
||||
## Contributors
|
||||
|
||||
### Code Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
||||
[](https://github.com/ohmyform/ohmyform/graphs/contributors)
|
||||
|
||||
### Financial Contributors
|
||||
|
||||
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/ohmyform-sustainability/contribute)]
|
||||
|
||||
#### Individuals
|
||||
|
||||
[](https://opencollective.com/ohmyform-sustainability)
|
||||
|
||||
#### Organizations
|
||||
|
||||
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/ohmyform-sustainability/contribute)]
|
||||
|
||||
[](https://opencollective.com/ohmyform-sustainability/organization/0/website)
|
||||
[](https://opencollective.com/ohmyform-sustainability/organization/1/website)
|
||||
[](https://opencollective.com/ohmyform-sustainability/organization/2/website)
|
||||
[](https://opencollective.com/ohmyform-sustainability/organization/2/website)
|
||||
[](https://opencollective.com/ohmyform-sustainability/organization/2/website)
|
||||
[](https://opencollective.com/ohmyform-sustainability/organization/2/website)
|
||||
|
||||
|
||||
661
SUBLICENSE.md
661
SUBLICENSE.md
@ -1,661 +0,0 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
1
api
Submodule
1
api
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c2c421baa6f41e4e6fb812fa2978956aaf7aa0dd
|
||||
2
api/.gitignore
vendored
2
api/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
/node_modules
|
||||
/yarn.lock
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
FROM node:10 AS builder
|
||||
MAINTAINER OhMyForm <admin@ohmyform.com>
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# just copy everhing
|
||||
COPY . .
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn build
|
||||
|
||||
FROM node:10-alpine
|
||||
|
||||
COPY --from=builder /usr/src/app /usr/src/app
|
||||
|
||||
EXPOSE 3000
|
||||
CMD [ "yarn", "start:prod" ]
|
||||
@ -1,55 +0,0 @@
|
||||
<p align="center">
|
||||
<a href="http://ohmyform.com/" target="blank"><img src="https://ohmyform.com/img/logo_text.svg" width="320" alt="OhMyForm Logo" /></a>
|
||||
</p>
|
||||
|
||||
## Description
|
||||
|
||||
[OhMyForm](https://github.com/ohmyforn) api backend
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ yarn install
|
||||
```
|
||||
|
||||
## Running the app
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ npm run start
|
||||
|
||||
# watch mode
|
||||
$ npm run start:dev
|
||||
|
||||
# incremental rebuild (webpack)
|
||||
$ npm run webpack
|
||||
$ npm run start:hmr
|
||||
|
||||
# production mode
|
||||
$ npm run start:prod
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ npm run test
|
||||
|
||||
# e2e tests
|
||||
$ npm run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ npm run test:cov
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
TODO
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Website - [https://ohmyform.com](https://ohmyform.com/)
|
||||
|
||||
## License
|
||||
|
||||
TODO
|
||||
@ -1,5 +0,0 @@
|
||||
{
|
||||
"language": "ts",
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src"
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
{
|
||||
"watch": ["src"],
|
||||
"ext": "ts",
|
||||
"ignore": ["src/**/*.spec.ts"],
|
||||
"exec": "node --inspect-brk -r ts-node/register src/main.ts"
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
{
|
||||
"watch": ["src"],
|
||||
"ext": "ts",
|
||||
"ignore": ["src/**/*.spec.ts"],
|
||||
"exec": "ts-node -r tsconfig-paths/register src/main.ts"
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
{
|
||||
"name": "ohmyform",
|
||||
"version": "0.1.0",
|
||||
"description": "Opensource alternative to TypeForm",
|
||||
"author": "multiple",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
||||
"format": "prettier --write \"src/**/*.ts\"",
|
||||
"start": "ts-node -r tsconfig-paths/register src/main.ts",
|
||||
"start:dev": "tsc-watch -p tsconfig.build.json --onSuccess \"node dist/main.js\"",
|
||||
"start:debug": "tsc-watch -p tsconfig.build.json --onSuccess \"node --inspect-brk dist/main.js\"",
|
||||
"start:prod": "node dist/main.js",
|
||||
"lint": "tslint -p tsconfig.json -c tslint.json",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@godaddy/terminus": "^4.1.2",
|
||||
"@nest-modules/mailer": "^1.1.3",
|
||||
"@nestjs/common": "^6.5.2",
|
||||
"@nestjs/core": "^6.5.2",
|
||||
"@nestjs/jwt": "^6.1.1",
|
||||
"@nestjs/mongoose": "^6.1.2",
|
||||
"@nestjs/passport": "^6.1.0",
|
||||
"@nestjs/platform-express": "^6.5.2",
|
||||
"@nestjs/swagger": "^3.1.0",
|
||||
"@nestjs/terminus": "^6.5.0",
|
||||
"@types/bcrypt": "^3.0.0",
|
||||
"@types/mongoose": "^5.5.11",
|
||||
"bcrypt": "^3.0.6",
|
||||
"class-transformer": "^0.2.3",
|
||||
"class-validator": "^0.9.1",
|
||||
"handlebars": "^4.1.2",
|
||||
"mongoose": "^5.6.7",
|
||||
"nestjs-typegoose": "^5.2.1",
|
||||
"passport": "^0.4.0",
|
||||
"passport-jwt": "^4.0.0",
|
||||
"passport-local": "^1.0.0",
|
||||
"reflect-metadata": "^0.1.12",
|
||||
"rimraf": "^2.6.2",
|
||||
"rxjs": "^6.3.3",
|
||||
"swagger-ui-express": "^4.0.7",
|
||||
"typegoose": "^5.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/testing": "6.1.1",
|
||||
"@types/express": "4.16.1",
|
||||
"@types/jest": "24.0.11",
|
||||
"@types/node": "11.13.4",
|
||||
"@types/supertest": "2.0.7",
|
||||
"jest": "24.7.1",
|
||||
"prettier": "1.17.0",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "24.0.2",
|
||||
"ts-node": "8.1.0",
|
||||
"tsc-watch": "2.2.1",
|
||||
"tsconfig-paths": "3.8.0",
|
||||
"tslint": "5.16.0",
|
||||
"typescript": "3.4.3"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"rootDir": "src",
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
},
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { AppService } from './app.service';
|
||||
import {ApiExcludeEndpoint} from "@nestjs/swagger"
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@ApiExcludeEndpoint()
|
||||
@Get()
|
||||
getIndex(): object {
|
||||
return {
|
||||
message: 'hello humanoid',
|
||||
_links: {
|
||||
doc: '/doc',
|
||||
health: '/health'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TerminusModule } from '@nestjs/terminus';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { TypegooseModule } from 'nestjs-typegoose';
|
||||
import { TerminusOptionsService } from './terminus-options.service';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { UserModule } from "./user/user.module"
|
||||
import { FormModule } from "./form/form.module"
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { MailModule } from "./mail/mail.module"
|
||||
import { MailerModule } from "@nest-modules/mailer"
|
||||
|
||||
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost/ohmyform'
|
||||
const MAILER_URI = process.env.MAILER_URI || 'smtp://localhost:1025'
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypegooseModule.forRoot(MONGODB_URI, { useNewUrlParser: true }),
|
||||
MongooseModule.forRoot(MONGODB_URI),
|
||||
TerminusModule.forRootAsync({
|
||||
useClass: TerminusOptionsService,
|
||||
}),
|
||||
MailerModule.forRoot({
|
||||
transport: MAILER_URI,
|
||||
defaults: {
|
||||
from:'"OhMyForm" <noreply@ohmyform.com>',
|
||||
}
|
||||
}),
|
||||
UserModule,
|
||||
FormModule,
|
||||
AuthModule,
|
||||
MailModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppModule {}
|
||||
@ -1,8 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import {AuthController} from "./controllers/auth.controller"
|
||||
import {RecoverController} from "./controllers/recover.controller"
|
||||
import {RegisterController} from "./controllers/register.controller"
|
||||
|
||||
export default [
|
||||
AuthController,
|
||||
RecoverController,
|
||||
RegisterController,
|
||||
]
|
||||
@ -1,23 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { UserModule } from '../user/user.module';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { jwtConstants } from "./constants"
|
||||
import { JwtModule } from "@nestjs/jwt"
|
||||
import controllers from './auth.controllers'
|
||||
import providers from './auth.providers'
|
||||
import { MailModule } from "../mail/mail.module"
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
UserModule,
|
||||
PassportModule,
|
||||
MailModule,
|
||||
JwtModule.register({
|
||||
secret: jwtConstants.secret,
|
||||
signOptions: { expiresIn: '12h' },
|
||||
}),
|
||||
],
|
||||
controllers,
|
||||
providers
|
||||
})
|
||||
export class AuthModule {}
|
||||
@ -1,15 +0,0 @@
|
||||
import { AuthService } from "./services/auth.service"
|
||||
import { PasswordService } from "./services/password.service"
|
||||
import { PasswordStrategy } from "./strategies/password.strategy"
|
||||
import { JwtStrategy } from "./strategies/jwt.strategy"
|
||||
import { JwtRefreshStrategy } from "./strategies/jwt.refresh.strategy"
|
||||
import { RegisterService } from "./services/register.service"
|
||||
|
||||
export default [
|
||||
AuthService,
|
||||
PasswordService,
|
||||
PasswordStrategy,
|
||||
JwtStrategy,
|
||||
JwtRefreshStrategy,
|
||||
RegisterService,
|
||||
]
|
||||
@ -1,3 +0,0 @@
|
||||
export const jwtConstants = {
|
||||
secret: 'secretKey',
|
||||
};
|
||||
@ -1,30 +0,0 @@
|
||||
import { Controller, Request, Post, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { AuthService } from "../services/auth.service"
|
||||
import { AuthJwtDto } from "../dto/auth.jwt.dto"
|
||||
import {ApiBearerAuth, ApiImplicitBody, ApiImplicitQuery, ApiResponse, ApiUseTags} from "@nestjs/swagger"
|
||||
|
||||
@ApiUseTags('authentication')
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@ApiResponse({ status: 201, description: 'Successful login.', type: AuthJwtDto})
|
||||
@ApiResponse({ status: 401, description: 'Invalid Credentials.'})
|
||||
@ApiImplicitQuery({name: 'username', type: String})
|
||||
@ApiImplicitQuery({name: 'password', type: String})
|
||||
@UseGuards(AuthGuard('password'))
|
||||
@Post('login')
|
||||
async login(@Request() req): Promise<AuthJwtDto> {
|
||||
return this.authService.createToken(req.user);
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@ApiResponse({ status: 201, description: 'Consumed Refresh Token.', type: AuthJwtDto})
|
||||
@ApiResponse({ status: 401, description: 'Invalid Token.'})
|
||||
@UseGuards(AuthGuard('jwt.refresh'))
|
||||
@Post('refresh')
|
||||
async refresh(@Request() req): Promise<AuthJwtDto> {
|
||||
return this.authService.createToken(req.user);
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
import { Controller, Request, Post, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { AuthService } from "../services/auth.service"
|
||||
import { AuthJwtDto } from "../dto/auth.jwt.dto"
|
||||
import {ApiBearerAuth, ApiImplicitBody, ApiImplicitQuery, ApiResponse, ApiUseTags} from "@nestjs/swagger"
|
||||
|
||||
@ApiUseTags('authentication')
|
||||
@Controller('auth/recover')
|
||||
export class RecoverController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@ApiResponse({ status: 201, description: 'Successful registration.', type: AuthJwtDto})
|
||||
@ApiImplicitQuery({name: 'email', type: String})
|
||||
@ApiImplicitQuery({name: 'username', type: String})
|
||||
@Post('request')
|
||||
async request(@Request() req): Promise<AuthJwtDto> {
|
||||
// TODO
|
||||
return null
|
||||
}
|
||||
|
||||
@ApiResponse({ status: 201, description: 'Successful registration.', type: AuthJwtDto})
|
||||
@ApiImplicitQuery({name: 'token', type: String})
|
||||
@ApiImplicitQuery({name: 'password', type: String})
|
||||
@Post('finish')
|
||||
async finish(@Request() req): Promise<AuthJwtDto> {
|
||||
// TODO
|
||||
return null
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import { Controller, Post, Body } from '@nestjs/common';
|
||||
import { AuthService } from "../services/auth.service"
|
||||
import { ApiBadRequestResponse, ApiCreatedResponse, ApiUseTags } from "@nestjs/swagger"
|
||||
import { RegisterDto } from "../dto/register.dto"
|
||||
import {RegisterService} from "../services/register.service"
|
||||
|
||||
@ApiUseTags('authentication')
|
||||
@Controller('auth')
|
||||
export class RegisterController {
|
||||
constructor(private readonly registerService: RegisterService) {}
|
||||
|
||||
@ApiCreatedResponse({ description: 'Successful registration.'})
|
||||
@ApiBadRequestResponse({})
|
||||
@Post('register')
|
||||
async register(@Body() params: RegisterDto): Promise<void> {
|
||||
await this.registerService.register(params.username, params.email, params.password)
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import { ApiModelProperty } from '@nestjs/swagger';
|
||||
|
||||
export class AuthJwtDto {
|
||||
@ApiModelProperty()
|
||||
accessToken: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
refreshToken: string;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import { ApiModelProperty } from "@nestjs/swagger"
|
||||
import { IsEmail, IsNotEmpty, Validate } from "class-validator"
|
||||
import { UsernameAlreadyInUse } from "../../user/validators/UsernameAlreadyInUse"
|
||||
import { EmailAlreadyInUse } from "../../user/validators/EmailAlreadyInUse"
|
||||
|
||||
export class RegisterDto {
|
||||
@ApiModelProperty()
|
||||
@IsNotEmpty()
|
||||
@Validate(UsernameAlreadyInUse)
|
||||
readonly username: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
@IsNotEmpty()
|
||||
readonly password: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
@Validate(EmailAlreadyInUse)
|
||||
@IsEmail()
|
||||
readonly email: string;
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
export interface AuthUser {
|
||||
id: string;
|
||||
username: string;
|
||||
email: string;
|
||||
roles: [string];
|
||||
created: Date;
|
||||
lastUpdated: Date;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
describe('AuthService', () => {
|
||||
let service: AuthService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [AuthService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<AuthService>(AuthService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@ -1,70 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { UserService } from '../../user/services/user.service';
|
||||
import { PasswordService } from "./password.service"
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { AuthUser } from "../interfaces/auth.user.interface"
|
||||
import { User } from "../../user/models/user.model"
|
||||
import { AuthJwtDto } from "../dto/auth.jwt.dto"
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
constructor(
|
||||
private readonly usersService: UserService,
|
||||
private readonly passwordService: PasswordService,
|
||||
private readonly jwtService: JwtService
|
||||
) {}
|
||||
|
||||
async verifyForLogin(identifier: string, pass: string): Promise<AuthUser | null> {
|
||||
try {
|
||||
const user = await this.usersService.findOneByIdentifier(identifier);
|
||||
|
||||
if (await this.passwordService.verify(pass, user.passwordHash, user.salt)) {
|
||||
return AuthService.setupAuthUser(user)
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async validate(identifier: string): Promise<AuthUser | null> {
|
||||
try {
|
||||
return AuthService.setupAuthUser(
|
||||
await this.usersService.findOneByIdentifier(identifier)
|
||||
)
|
||||
} catch (e) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static setupAuthUser(user:User):AuthUser {
|
||||
return {
|
||||
id: user._id,
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
roles: user.roles,
|
||||
created: user.created,
|
||||
lastUpdated: user.lastModified
|
||||
};
|
||||
}
|
||||
|
||||
async createToken(user: AuthUser): Promise<AuthJwtDto> {
|
||||
const payload = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
scope: user.roles,
|
||||
};
|
||||
return {
|
||||
accessToken: this.jwtService.sign(payload),
|
||||
// TODO add refresh token invalidation uppon usage! They should only work once
|
||||
refreshToken: this.jwtService.sign(
|
||||
{
|
||||
...payload,
|
||||
refresh: true
|
||||
},
|
||||
{
|
||||
expiresIn: '30days',
|
||||
}
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
import { Injectable } from "@nestjs/common"
|
||||
import * as crypto from 'crypto'
|
||||
import * as bcrypt from 'bcrypt'
|
||||
|
||||
@Injectable()
|
||||
export class PasswordService {
|
||||
async verify (password: string, hash: string, salt?: string): Promise<boolean> {
|
||||
console.log('try to verify password', password)
|
||||
if (password[0] === '$') {
|
||||
return await bcrypt.compare(password, hash)
|
||||
}
|
||||
|
||||
//Generate salt if it doesn't exist yet
|
||||
if(!salt){
|
||||
salt = crypto.randomBytes(64).toString('base64');
|
||||
}
|
||||
|
||||
return hash === crypto.pbkdf2Sync(
|
||||
password,
|
||||
new Buffer(salt, 'base64'),
|
||||
10000,
|
||||
128,
|
||||
'SHA1'
|
||||
).toString('base64');
|
||||
}
|
||||
|
||||
hash (password): Promise<string> {
|
||||
return bcrypt.hash(password, 4)
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
import { Injectable } from "@nestjs/common"
|
||||
import { MailService } from "../../mail/services/mail.service"
|
||||
import { User } from "../../user/models/user.model"
|
||||
import { PasswordService } from "./password.service"
|
||||
import { UserService } from "../../user/services/user.service"
|
||||
|
||||
@Injectable()
|
||||
export class RegisterService {
|
||||
constructor(
|
||||
private readonly mailService: MailService,
|
||||
private readonly passwordService: PasswordService,
|
||||
private readonly userService: UserService
|
||||
) {}
|
||||
|
||||
async register (username: string, email: string, password: string): Promise<void> {
|
||||
let user = new User()
|
||||
user.email = email
|
||||
user.username = username
|
||||
user.passwordHash = await this.passwordService.hash(password)
|
||||
|
||||
await this.userService.save(user)
|
||||
|
||||
await this.mailService.sendEmail(
|
||||
{
|
||||
template: 'auth/register',
|
||||
to: email
|
||||
},
|
||||
{
|
||||
confirm: 'some url'
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { jwtConstants } from '../constants';
|
||||
import { AuthService } from "../services/auth.service"
|
||||
import { AuthUser } from "../interfaces/auth.user.interface"
|
||||
|
||||
@Injectable()
|
||||
export class JwtRefreshStrategy extends PassportStrategy(Strategy, 'jwt.refresh') {
|
||||
constructor(private readonly authService: AuthService) {
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
ignoreExpiration: false,
|
||||
secretOrKey: jwtConstants.secret,
|
||||
});
|
||||
}
|
||||
|
||||
async validate(payload: any): Promise<AuthUser | null> {
|
||||
if (!payload.refresh) {
|
||||
return null
|
||||
}
|
||||
|
||||
// TODO add refresh token invalidation uppon usage! They should only work once
|
||||
return this.authService.validate(payload.username);
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { jwtConstants } from '../constants';
|
||||
import { AuthService } from "../services/auth.service"
|
||||
import {AuthUser} from "../interfaces/auth.user.interface"
|
||||
|
||||
@Injectable()
|
||||
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
constructor(private readonly authService: AuthService) {
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
ignoreExpiration: false,
|
||||
secretOrKey: jwtConstants.secret,
|
||||
});
|
||||
}
|
||||
|
||||
async validate(payload: any): Promise<AuthUser | null> {
|
||||
return this.authService.validate(payload.username);
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
import { Strategy } from 'passport-local';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import {AuthUser} from "../interfaces/auth.user.interface"
|
||||
|
||||
@Injectable()
|
||||
export class PasswordStrategy extends PassportStrategy(Strategy, 'password') {
|
||||
constructor(private readonly authService: AuthService) {
|
||||
super();
|
||||
}
|
||||
|
||||
validate(username: string, password: string): Promise<AuthUser | null> {
|
||||
return this.authService.verifyForLogin(username, password);
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import { IsMongoId } from 'class-validator';
|
||||
|
||||
export class FindOneDto {
|
||||
@IsMongoId()
|
||||
id: string;
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
import {Controller, Request, Get, Post, Put, Delete, UseGuards, Param, NotImplementedException} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiBearerAuth, ApiImplicitQuery, ApiResponse, ApiUseTags } from "@nestjs/swagger"
|
||||
import { FormService } from "../services/form.service"
|
||||
import { FormDto } from "../dto/form.dto"
|
||||
import { FindOneDto } from "../../core/dto/find.one.dto"
|
||||
|
||||
@ApiUseTags('forms')
|
||||
@ApiBearerAuth()
|
||||
@Controller('forms')
|
||||
export class FormController {
|
||||
constructor(private readonly formService: FormService) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async list(@Request() req): Promise<FormDto[]> {
|
||||
// TODO calculate total forms, add for pagination
|
||||
const results = await this.formService.findBy({})
|
||||
return results.map(form => new FormDto(form))
|
||||
}
|
||||
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async create(@Request() req): Promise<FormDto> {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@ApiResponse({ status: 200, description: 'Form Object', type: FormDto})
|
||||
@ApiImplicitQuery({name: 'id', type: String})
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async read(@Param() params: FindOneDto): Promise<FormDto> {
|
||||
return new FormDto(await this.formService.findById(params.id));
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async update(@Param() params: FindOneDto, @Request() req): Promise<FormDto> {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async delete(@Param() params: FindOneDto): Promise<void> {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
import { Controller, Get, Param, NotFoundException } from '@nestjs/common';
|
||||
import { ApiImplicitQuery, ApiResponse, ApiUseTags } from "@nestjs/swagger"
|
||||
import { FormService } from "../services/form.service"
|
||||
import { Form } from "../models/form.model"
|
||||
import { PublicFormDto } from "../dto/public.form.dto"
|
||||
import { FindOneDto } from "../../core/dto/find.one.dto"
|
||||
|
||||
@ApiUseTags('forms')
|
||||
@Controller('public')
|
||||
export class PublicController {
|
||||
constructor(private readonly formService: FormService) {}
|
||||
|
||||
@ApiResponse({ status: 200, description: 'Form Object', type: PublicFormDto})
|
||||
@ApiImplicitQuery({name: 'id', type: String})
|
||||
@Get(':id')
|
||||
async read(@Param() params: FindOneDto): Promise<PublicFormDto> {
|
||||
const form:Form = await this.formService.findById(params.id)
|
||||
|
||||
if (!form.isLive) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
return new PublicFormDto(form);
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
import { ApiModelProperty } from '@nestjs/swagger';
|
||||
import { Form } from "../models/form.model"
|
||||
|
||||
export class FormDto {
|
||||
@ApiModelProperty()
|
||||
id: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
title: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
live: boolean;
|
||||
|
||||
@ApiModelProperty()
|
||||
created: Date;
|
||||
|
||||
@ApiModelProperty()
|
||||
lastModified: Date;
|
||||
|
||||
@ApiModelProperty()
|
||||
fields: any;
|
||||
|
||||
@ApiModelProperty()
|
||||
info: {
|
||||
responses: number;
|
||||
}
|
||||
|
||||
constructor(partial: Partial<Form>) {
|
||||
this.id = partial._id.toString()
|
||||
this.title = partial.title
|
||||
this.live = partial.isLive
|
||||
this.created = partial.created
|
||||
this.lastModified = partial.lastModified
|
||||
this.fields = partial.form_fields
|
||||
this.info = {
|
||||
responses: 0 // TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
import { ApiModelProperty } from '@nestjs/swagger';
|
||||
import { Form } from "../models/form.model"
|
||||
|
||||
export class PublicFormDto {
|
||||
@ApiModelProperty()
|
||||
id: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
title: string;
|
||||
|
||||
fields: [];
|
||||
|
||||
constructor(partial: Partial<Form>) {
|
||||
this.id = partial._id.toString();
|
||||
this.title = partial.title
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
import { FormController } from "./controllers/form.controller"
|
||||
import { PublicController } from "./controllers/public.controller"
|
||||
|
||||
export default [
|
||||
FormController,
|
||||
PublicController,
|
||||
]
|
||||
@ -1,15 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import controllers from './form.controllers';
|
||||
import providers from './form.providers'
|
||||
import {TypegooseModule} from "nestjs-typegoose"
|
||||
import {Form} from "./models/form.model"
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypegooseModule.forFeature([Form]),
|
||||
],
|
||||
exports: [],
|
||||
controllers,
|
||||
providers,
|
||||
})
|
||||
export class FormModule {}
|
||||
@ -1,5 +0,0 @@
|
||||
import { FormService } from "./services/form.service"
|
||||
|
||||
export default [
|
||||
FormService
|
||||
]
|
||||
@ -1,5 +0,0 @@
|
||||
import { Document } from 'mongoose';
|
||||
|
||||
export interface Button extends Document{
|
||||
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
import { Document } from 'mongoose';
|
||||
|
||||
export interface Field extends Document{
|
||||
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
import { Document } from 'mongoose';
|
||||
import { Field } from "./field.interface"
|
||||
import { Button } from "./button.interface"
|
||||
|
||||
export class Form extends Document{
|
||||
readonly firstName: string;
|
||||
readonly language: string;
|
||||
readonly analytics: string;
|
||||
readonly form_fields: Field[];
|
||||
readonly admin: any;
|
||||
readonly startPage: {
|
||||
readonly showStart: boolean;
|
||||
readonly introTitle: string;
|
||||
readonly introParagraph: string;
|
||||
readonly introButtonText: string;
|
||||
readonly buttons: Button[];
|
||||
};
|
||||
readonly endPage: {
|
||||
readonly showEnd: boolean;
|
||||
readonly title: string;
|
||||
readonly paragraph: string;
|
||||
readonly buttonText: string;
|
||||
readonly buttons: Button[];
|
||||
};
|
||||
readonly selfNotifications: {
|
||||
readonly fromField: string;
|
||||
readonly toEmails: string;
|
||||
readonly subject: string;
|
||||
readonly htmlTemplate: string;
|
||||
readonly enabled: boolean;
|
||||
};
|
||||
readonly respondentNotifications: {
|
||||
readonly toField: string;
|
||||
readonly fromEmails: string;
|
||||
readonly subject: string;
|
||||
readonly htmlTemplate: string;
|
||||
readonly enabled: boolean;
|
||||
};
|
||||
readonly showFooter: boolean;
|
||||
readonly isLive: boolean;
|
||||
readonly design: {
|
||||
readonly colors: {
|
||||
readonly backgroundColor: string;
|
||||
readonly questionColor: string;
|
||||
readonly answerColor: string;
|
||||
readonly buttonColor: string;
|
||||
readonly buttonTextColor: string;
|
||||
};
|
||||
readonly font: string;
|
||||
};
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {VisitorData} from "./visitor.data"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class Analytics {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop()
|
||||
gaCode: string;
|
||||
|
||||
@prop()
|
||||
visitors: VisitorData[]
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
import {Exclude} from "class-transformer"
|
||||
import {prop} from "typegoose"
|
||||
|
||||
export class Button {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
match: /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/
|
||||
})
|
||||
url: string;
|
||||
|
||||
@prop()
|
||||
action: string;
|
||||
|
||||
@prop()
|
||||
text: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#5bc0de'
|
||||
})
|
||||
bgColor: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#ffffff'
|
||||
})
|
||||
color: string;
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
import {prop, Ref, Typegoose} from "typegoose"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class Colors {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#fff'
|
||||
})
|
||||
readonly backgroundColor: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#333'
|
||||
})
|
||||
readonly questionColor: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#333'
|
||||
})
|
||||
readonly answerColor: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#fff'
|
||||
})
|
||||
readonly buttonColor: string;
|
||||
|
||||
@prop({
|
||||
match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/],
|
||||
default: '#333'
|
||||
})
|
||||
readonly buttonTextColor: string;
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {Colors} from "./colors"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class Design {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop()
|
||||
readonly colors: Colors;
|
||||
|
||||
@prop()
|
||||
readonly font: string;
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {Button} from "./button"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class EndPage {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
readonly showEnd: boolean;
|
||||
|
||||
@prop({
|
||||
default: 'Thank you for filling out the form'
|
||||
})
|
||||
readonly title: string;
|
||||
|
||||
@prop()
|
||||
readonly paragraph: string;
|
||||
|
||||
@prop({
|
||||
default: 'Go back to Form'
|
||||
})
|
||||
readonly buttonText: string;
|
||||
|
||||
@prop()
|
||||
readonly buttons: Button[];
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {VisitorData} from "./visitor.data"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class FieldOption {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop()
|
||||
option_id: number;
|
||||
|
||||
@prop()
|
||||
option_title: string;
|
||||
|
||||
@prop({
|
||||
trim: true
|
||||
})
|
||||
option_value: string;
|
||||
}
|
||||
@ -1,83 +0,0 @@
|
||||
import {arrayProp, prop} from "typegoose"
|
||||
import {LogicJump} from "./logic.jump"
|
||||
import {RatingField} from "./rating.field"
|
||||
import {FieldOption} from "./field.option"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class Field {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
isSubmission: boolean;
|
||||
|
||||
@prop()
|
||||
submissionId: string;
|
||||
|
||||
@prop({
|
||||
trim: true
|
||||
})
|
||||
title: string;
|
||||
|
||||
@prop({
|
||||
default: ''
|
||||
})
|
||||
description: string;
|
||||
|
||||
@prop()
|
||||
logicJump: LogicJump;
|
||||
|
||||
@prop()
|
||||
ratingOptions: RatingField;
|
||||
|
||||
@arrayProp({
|
||||
items: FieldOption
|
||||
})
|
||||
fieldOptions: FieldOption[];
|
||||
|
||||
@prop({
|
||||
default: true
|
||||
})
|
||||
required: boolean;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
disabled: boolean;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
deletePreserved: boolean;
|
||||
|
||||
@arrayProp({
|
||||
items: String
|
||||
})
|
||||
validFieldTypes: boolean;
|
||||
|
||||
@prop({
|
||||
enum: [
|
||||
'textfield',
|
||||
'date',
|
||||
'email',
|
||||
'legal',
|
||||
'textarea',
|
||||
'link',
|
||||
'statement',
|
||||
'dropdown',
|
||||
'rating',
|
||||
'radio',
|
||||
'hidden',
|
||||
'yes_no',
|
||||
'number'
|
||||
]
|
||||
})
|
||||
fieldType: string;
|
||||
|
||||
@prop({
|
||||
default: ''
|
||||
})
|
||||
fieldValue: any;
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
import {prop, Ref} from "typegoose"
|
||||
import {VisitorData} from "./visitor.data"
|
||||
import {Exclude} from "class-transformer"
|
||||
import {Field} from "./field"
|
||||
|
||||
export class LogicJump {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
enum: [
|
||||
'field == static',
|
||||
'field != static',
|
||||
'field > static',
|
||||
'field >= static',
|
||||
'field <= static',
|
||||
'field < static',
|
||||
'field contains static',
|
||||
'field !contains static',
|
||||
'field begins static',
|
||||
'field !begins static',
|
||||
'field ends static',
|
||||
'field !ends static'
|
||||
]
|
||||
})
|
||||
expressionString: string;
|
||||
|
||||
@prop({
|
||||
ref: Field
|
||||
})
|
||||
fieldA: Ref<Field>;
|
||||
|
||||
@prop()
|
||||
valueB: string;
|
||||
|
||||
@prop({
|
||||
ref: Field
|
||||
})
|
||||
jumpTo: Ref<Field>;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
enabled: boolean;
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
import {arrayProp, prop} from "typegoose"
|
||||
import {VisitorData} from "./visitor.data"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class RatingField {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
min: 1,
|
||||
max: 10
|
||||
})
|
||||
steps: number;
|
||||
|
||||
@prop({
|
||||
enum: [
|
||||
'Heart',
|
||||
'Star',
|
||||
'thumbs-up',
|
||||
'thumbs-down',
|
||||
'Circle',
|
||||
'Square',
|
||||
'Check Circle',
|
||||
'Smile Outlined',
|
||||
'Hourglass',
|
||||
'bell',
|
||||
'Paper Plane',
|
||||
'Comment',
|
||||
'Trash'
|
||||
]
|
||||
})
|
||||
shape: string;
|
||||
|
||||
@arrayProp({
|
||||
items: String
|
||||
})
|
||||
validShapes: [string];
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class RespondentNotifications {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop()
|
||||
readonly toField: string;
|
||||
|
||||
@prop({
|
||||
match: [/.+\@.+\..+/, 'Please fill a valid email address']
|
||||
})
|
||||
readonly fromEmails: string;
|
||||
|
||||
@prop({
|
||||
default: 'OhMyForm: Thank you for filling out this OhMyForm'
|
||||
})
|
||||
readonly subject: string;
|
||||
|
||||
@prop({
|
||||
default: 'Hello, <br><br> We’ve received your submission. <br><br> Thank you & have a nice day!',
|
||||
})
|
||||
readonly htmlTemplate: string;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
readonly enabled: boolean;
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class SelfNotifications {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop()
|
||||
readonly fromField: string;
|
||||
|
||||
@prop()
|
||||
readonly toEmails: string;
|
||||
|
||||
@prop()
|
||||
readonly subject: string;
|
||||
|
||||
@prop()
|
||||
readonly htmlTemplate: string;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
readonly enabled: boolean;
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
import {prop} from "typegoose"
|
||||
import {Button} from "./button"
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
export class StartPage {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
default: false
|
||||
})
|
||||
readonly showStart: boolean;
|
||||
|
||||
@prop({
|
||||
default: 'Welcome to Form'
|
||||
})
|
||||
readonly introTitle: string;
|
||||
|
||||
@prop()
|
||||
readonly introParagraph: string;
|
||||
|
||||
@prop({
|
||||
default: 'Start'
|
||||
})
|
||||
readonly introButtonText: string;
|
||||
|
||||
@prop()
|
||||
readonly buttons: Button[];
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
import {Exclude} from "class-transformer"
|
||||
import {arrayProp, prop} from "typegoose"
|
||||
import {Field} from "./field"
|
||||
import {Ref} from "typegoose/lib/prop"
|
||||
|
||||
export class VisitorData {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop()
|
||||
readonly introParagraph: string;
|
||||
|
||||
@prop()
|
||||
readonly referrer: string;
|
||||
|
||||
@arrayProp({
|
||||
itemsRef: Field
|
||||
})
|
||||
readonly filledOutFields: Ref<Field>[];
|
||||
|
||||
@prop()
|
||||
readonly timeElapsed: number;
|
||||
|
||||
@prop()
|
||||
readonly isSubmitted: boolean;
|
||||
|
||||
@prop({
|
||||
enum: ['en', 'fr', 'es', 'it', 'de'],
|
||||
default: 'en',
|
||||
})
|
||||
readonly language: string;
|
||||
|
||||
@prop()
|
||||
readonly ipAddr: string;
|
||||
|
||||
@prop({
|
||||
enum: ['desktop', 'phone', 'tablet', 'other'],
|
||||
default: 'other'
|
||||
})
|
||||
readonly deviceType: string;
|
||||
|
||||
@prop()
|
||||
readonly userAgent: string;
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
import {arrayProp, prop, Ref, Typegoose} from "typegoose"
|
||||
import {Analytics} from "./embedded/analytics"
|
||||
import {Field} from "./embedded/field"
|
||||
import {StartPage} from "./embedded/start.page"
|
||||
import {EndPage} from "./embedded/end.page"
|
||||
import {SelfNotifications} from "./embedded/self.notifications"
|
||||
import {RespondentNotifications} from "./embedded/respondent.notifications"
|
||||
import {Design} from "./embedded/design"
|
||||
import {User} from "../../user/models/user.model"
|
||||
|
||||
export class Form extends Typegoose {
|
||||
readonly _id: any;
|
||||
|
||||
@prop({
|
||||
trim: true,
|
||||
required: 'Form Title cannot be blank'
|
||||
})
|
||||
readonly title: string;
|
||||
|
||||
@prop()
|
||||
readonly created: any;
|
||||
|
||||
@prop()
|
||||
readonly lastModified: any;
|
||||
|
||||
@prop({
|
||||
enum: ['en', 'fr', 'es', 'it', 'de'],
|
||||
default: 'en',
|
||||
required: 'Form must have a language'
|
||||
})
|
||||
readonly language: string;
|
||||
|
||||
@prop()
|
||||
readonly analytics: Analytics;
|
||||
|
||||
@arrayProp({
|
||||
items: Field,
|
||||
default: []
|
||||
})
|
||||
readonly form_fields: Field[];
|
||||
|
||||
@prop({
|
||||
ref: User,
|
||||
required: 'Form must have an Admin'
|
||||
})
|
||||
readonly admin: Ref<User>;
|
||||
|
||||
@prop()
|
||||
readonly startPage: StartPage;
|
||||
|
||||
@prop()
|
||||
readonly endPage: EndPage;
|
||||
|
||||
@prop()
|
||||
readonly selfNotifications: SelfNotifications;
|
||||
|
||||
@prop()
|
||||
readonly respondentNotifications: RespondentNotifications;
|
||||
|
||||
@prop({
|
||||
default: true
|
||||
})
|
||||
readonly showFooter: boolean;
|
||||
|
||||
@prop({
|
||||
default: true
|
||||
})
|
||||
readonly isLive: boolean;
|
||||
|
||||
@prop()
|
||||
readonly design: Design;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import {Injectable} from '@nestjs/common';
|
||||
import { InjectModel } from 'nestjs-typegoose';
|
||||
import { ModelType } from 'typegoose';
|
||||
import {Form} from "../models/form.model"
|
||||
import {User} from "../../user/models/user.model"
|
||||
|
||||
@Injectable()
|
||||
export class FormService {
|
||||
constructor(@InjectModel(Form) private readonly formModel: ModelType<Form>) {}
|
||||
|
||||
async findById(id: string): Promise<Form> {
|
||||
return await this.formModel.findById(id).exec()
|
||||
}
|
||||
|
||||
async findBy(conditions): Promise<Form[]> {
|
||||
return await this.formModel.find(conditions).exec()
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
|
||||
export class OptionsDto {
|
||||
template: string;
|
||||
|
||||
language?: string;
|
||||
|
||||
to: string;
|
||||
|
||||
cc?: string[];
|
||||
|
||||
bcc?: string[];
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
import { MailService } from "./services/mail.service"
|
||||
|
||||
export default [
|
||||
MailService
|
||||
]
|
||||
@ -1,12 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import providers from './mail.providers'
|
||||
import exportList from './mail.exports'
|
||||
import { HandlebarsAdapter, MailerModule } from "@nest-modules/mailer"
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
],
|
||||
providers,
|
||||
exports: exportList,
|
||||
})
|
||||
export class MailModule {}
|
||||
@ -1,5 +0,0 @@
|
||||
import { MailService } from "./services/mail.service"
|
||||
|
||||
export default [
|
||||
MailService
|
||||
]
|
||||
@ -1,35 +0,0 @@
|
||||
import {Inject, Injectable, NotFoundException} from '@nestjs/common';
|
||||
import { OptionsDto } from "../dto/options.dto"
|
||||
import { MailerService } from '@nest-modules/mailer';
|
||||
import * as Handlebars from 'handlebars'
|
||||
import * as fs from 'fs';
|
||||
|
||||
@Injectable()
|
||||
export class MailService {
|
||||
constructor(
|
||||
private readonly nodeMailer: MailerService
|
||||
) {}
|
||||
|
||||
async sendEmail(options:OptionsDto, placeholders:any): Promise<boolean> {
|
||||
const template = fs.readFileSync(`${__dirname}/../../../views/en/mail/${options.template}.hbs`, 'UTF-8');
|
||||
|
||||
const parts = Handlebars
|
||||
.compile(template)
|
||||
(placeholders)
|
||||
.split('---')
|
||||
|
||||
const mail:any = {
|
||||
to: options.to,
|
||||
subject: parts[0],
|
||||
text: parts[1],
|
||||
}
|
||||
|
||||
if (parts.length > 2) {
|
||||
mail.html = parts[2]
|
||||
}
|
||||
|
||||
await this.nodeMailer.sendMail(mail)
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
import {NestFactory, Reflector} from '@nestjs/core';
|
||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||
import { AppModule } from './app.module';
|
||||
import { ClassSerializerInterceptor, ValidationPipe } from '@nestjs/common';
|
||||
import { useContainer } from "class-validator"
|
||||
const pkg = require('../package.json')
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, { cors: true });
|
||||
|
||||
useContainer(app.select(AppModule), { fallbackOnErrors: true });
|
||||
|
||||
app.useGlobalPipes(new ValidationPipe({
|
||||
disableErrorMessages: false,
|
||||
transform: true,
|
||||
}));
|
||||
|
||||
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)))
|
||||
|
||||
const options = new DocumentBuilder()
|
||||
.setTitle('OhMyForm')
|
||||
.setDescription('API documentation')
|
||||
.setVersion(pkg.version)
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app, options);
|
||||
SwaggerModule.setup('doc', app, document);
|
||||
|
||||
await app.listen(3000);
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
@ -1,29 +0,0 @@
|
||||
import {
|
||||
TerminusEndpoint,
|
||||
TerminusOptionsFactory,
|
||||
DNSHealthIndicator,
|
||||
MongooseHealthIndicator,
|
||||
TerminusModuleOptions
|
||||
} from '@nestjs/terminus';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class TerminusOptionsService implements TerminusOptionsFactory {
|
||||
constructor(
|
||||
private readonly dns: DNSHealthIndicator,
|
||||
private readonly mongoose: MongooseHealthIndicator
|
||||
) {}
|
||||
|
||||
createTerminusOptions(): TerminusModuleOptions {
|
||||
const healthEndpoint: TerminusEndpoint = {
|
||||
url: '/health',
|
||||
healthIndicators: [
|
||||
async () => this.dns.pingCheck('mail', 'https://google.com'),
|
||||
async () => this.mongoose.pingCheck('mongo')
|
||||
],
|
||||
};
|
||||
return {
|
||||
endpoints: [healthEndpoint],
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
import {Controller, Request, Get, Post, Put, Delete, UseGuards, Param, NotImplementedException} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiBearerAuth, ApiImplicitQuery, ApiResponse, ApiUseTags } from "@nestjs/swagger"
|
||||
import { UserService } from "../services/user.service"
|
||||
import { UserDto } from "../dto/user.dto"
|
||||
import { FindOneDto } from "../../core/dto/find.one.dto"
|
||||
|
||||
@ApiUseTags('users')
|
||||
@ApiBearerAuth()
|
||||
@Controller('users')
|
||||
export class UserController {
|
||||
constructor(private readonly userService: UserService) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async list(@Request() req): Promise<UserDto[]> {
|
||||
// TODO calculate total forms, add for pagination
|
||||
const results = await this.userService.findBy({})
|
||||
return results.map(form => new UserDto(form))
|
||||
}
|
||||
|
||||
@ApiResponse({ status: 200, description: 'User Object', type: UserDto})
|
||||
@Post()
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async create(@Request() req): Promise<UserDto> {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
@ApiResponse({ status: 200, description: 'User Object', type: UserDto})
|
||||
@ApiImplicitQuery({name: 'id', type: String})
|
||||
@Get(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async read(@Param() params: FindOneDto): Promise<UserDto> {
|
||||
return new UserDto(await this.userService.findById(params.id));
|
||||
}
|
||||
|
||||
@ApiResponse({ status: 200, description: 'User Object', type: UserDto})
|
||||
@ApiImplicitQuery({name: 'id', type: String})
|
||||
@Put(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async update(@Param() params: FindOneDto, @Request() req): Promise<UserDto> {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
|
||||
|
||||
@ApiResponse({ status: 200, description: 'User Object', type: UserDto})
|
||||
@ApiImplicitQuery({name: 'id', type: String})
|
||||
@Delete(':id')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
async delete(@Param() params: FindOneDto): Promise<void> {
|
||||
throw new NotImplementedException()
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
import { ApiModelProperty } from '@nestjs/swagger';
|
||||
import {User} from "../models/user.model"
|
||||
|
||||
export class UserDto {
|
||||
@ApiModelProperty()
|
||||
id: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
username: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
email: string;
|
||||
|
||||
@ApiModelProperty()
|
||||
roles: string[];
|
||||
|
||||
@ApiModelProperty()
|
||||
created: Date;
|
||||
|
||||
constructor(partial: Partial<User>) {
|
||||
this.id = partial._id.toString()
|
||||
this.username = partial.username
|
||||
this.email = partial.email
|
||||
this.roles = partial.roles
|
||||
this.created = partial.created
|
||||
}
|
||||
}
|
||||
@ -1,97 +0,0 @@
|
||||
import {arrayProp, pre, prop, Typegoose} from 'typegoose';
|
||||
import { IsString } from 'class-validator';
|
||||
import {Exclude} from "class-transformer"
|
||||
|
||||
@pre<User>('save', (next) => {
|
||||
this.lastModified = new Date()
|
||||
next()
|
||||
})
|
||||
export class User extends Typegoose {
|
||||
@Exclude()
|
||||
readonly _id: string;
|
||||
|
||||
@prop({
|
||||
trim: true,
|
||||
default: ''
|
||||
})
|
||||
firstName: string;
|
||||
|
||||
@prop({
|
||||
trim: true,
|
||||
default: ''
|
||||
})
|
||||
lastName: string;
|
||||
|
||||
@prop({
|
||||
trim: true,
|
||||
lowercase: true,
|
||||
unique: true, // 'Account already exists with this email',
|
||||
match: [
|
||||
/^(([^<>()\[\]\\.,;:\s@']+(\.[^<>()\[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
||||
'Please fill a valid email address'
|
||||
],
|
||||
required: [true, 'Email is required']
|
||||
})
|
||||
email: string;
|
||||
|
||||
@prop({
|
||||
unique: true,
|
||||
lowercase: true,
|
||||
match: [
|
||||
/^[a-zA-Z0-9\-]+$/,
|
||||
'Username can only contain alphanumeric characters and \'-\''
|
||||
],
|
||||
required: [true, 'Username is required']
|
||||
})
|
||||
username: string;
|
||||
|
||||
@prop({
|
||||
default: ''
|
||||
})
|
||||
passwordHash: string;
|
||||
|
||||
@prop()
|
||||
salt: string;
|
||||
|
||||
@prop({
|
||||
default: 'local'
|
||||
})
|
||||
provider: string;
|
||||
|
||||
@arrayProp({
|
||||
items: String,
|
||||
enum: ['user', 'admin', 'superuser'],
|
||||
default: ['user']
|
||||
})
|
||||
roles: [string];
|
||||
|
||||
@prop({
|
||||
enum: ['en', 'fr', 'es', 'it', 'de'],
|
||||
default: 'en',
|
||||
})
|
||||
language: string;
|
||||
|
||||
@prop({
|
||||
default: Date.now
|
||||
})
|
||||
readonly created: Date;
|
||||
|
||||
@prop()
|
||||
readonly lastModified: Date;
|
||||
|
||||
@prop()
|
||||
resetPasswordToken: string;
|
||||
|
||||
@prop()
|
||||
resetPasswordExpires: Date;
|
||||
|
||||
@prop()
|
||||
token: string;
|
||||
|
||||
@prop({
|
||||
unique: true,
|
||||
index: true,
|
||||
sparse: true
|
||||
})
|
||||
apiKey: string;
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
import { Injectable, OnModuleInit } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class InitService implements OnModuleInit {
|
||||
onModuleInit() {
|
||||
if (!process.env.CREATE_ADMIN || process.env.CREATE_ADMIN.toUpperCase() === 'FALSE') {
|
||||
console.log('SKIP INITIAL ADMIN USER CREATION')
|
||||
return
|
||||
}
|
||||
|
||||
// TODO process user creation if ENV CREATE_ADMIN is set
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UserService } from './users.service';
|
||||
|
||||
describe('UsersService', () => {
|
||||
let service: UserService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [UserService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<UserService>(UserService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@ -1,44 +0,0 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { InjectModel } from 'nestjs-typegoose';
|
||||
import { ModelType } from 'typegoose';
|
||||
import { User } from "../models/user.model"
|
||||
import {Form} from "../../form/models/form.model"
|
||||
|
||||
@Injectable()
|
||||
export class UserService {
|
||||
constructor(@InjectModel(User) private readonly userModel: ModelType<User>) {}
|
||||
|
||||
async findOneByIdentifier(identifier: string): Promise<User> {
|
||||
const results = await this.userModel.find().or([
|
||||
{
|
||||
username: identifier
|
||||
},
|
||||
{
|
||||
email: identifier
|
||||
}
|
||||
]).exec();
|
||||
|
||||
if (results.length !== 1) {
|
||||
throw new NotFoundException()
|
||||
}
|
||||
|
||||
return results[0]
|
||||
}
|
||||
|
||||
async findById(id: string): Promise<User> {
|
||||
return await this.userModel.findById(id).exec()
|
||||
}
|
||||
|
||||
async findOneBy(conditions): Promise<User> {
|
||||
return await this.userModel.findOne(conditions).exec()
|
||||
}
|
||||
|
||||
async findBy(conditions): Promise<User[]> {
|
||||
return await this.userModel.find(conditions).exec()
|
||||
}
|
||||
|
||||
async save(user: User): Promise<User> {
|
||||
let model = new this.userModel(user)
|
||||
return await model.save()
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
import { UserController } from "./controllers/user.controller"
|
||||
|
||||
export default [
|
||||
UserController,
|
||||
]
|
||||
@ -1,9 +0,0 @@
|
||||
import { UserService } from "./services/user.service"
|
||||
import { UsernameAlreadyInUse } from "./validators/UsernameAlreadyInUse"
|
||||
import { EmailAlreadyInUse } from "./validators/EmailAlreadyInUse"
|
||||
|
||||
export default [
|
||||
UserService,
|
||||
UsernameAlreadyInUse,
|
||||
EmailAlreadyInUse,
|
||||
]
|
||||
@ -1,16 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypegooseModule } from 'nestjs-typegoose';
|
||||
import providers from './user.providers'
|
||||
import exportList from './user.exports'
|
||||
import { User } from "./models/user.model"
|
||||
import controllers from './user.controllers'
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypegooseModule.forFeature([User]),
|
||||
],
|
||||
controllers,
|
||||
providers,
|
||||
exports: exportList,
|
||||
})
|
||||
export class UserModule {}
|
||||
@ -1,11 +0,0 @@
|
||||
import { UserService } from "./services/user.service"
|
||||
import { UsernameAlreadyInUse } from "./validators/UsernameAlreadyInUse"
|
||||
import { EmailAlreadyInUse } from "./validators/EmailAlreadyInUse"
|
||||
import { InitService } from "./services/init.service"
|
||||
|
||||
export default [
|
||||
InitService,
|
||||
UserService,
|
||||
UsernameAlreadyInUse,
|
||||
EmailAlreadyInUse,
|
||||
]
|
||||
@ -1,20 +0,0 @@
|
||||
import { ValidationArguments, ValidatorConstraint } from "class-validator"
|
||||
import { Inject, Injectable } from "@nestjs/common"
|
||||
import { UserService } from "../services/user.service"
|
||||
|
||||
@ValidatorConstraint({ name: 'EmailAlreadyInUse', async: true })
|
||||
@Injectable()
|
||||
export class EmailAlreadyInUse {
|
||||
constructor(
|
||||
@Inject('UserService') private readonly userService: UserService,
|
||||
) {}
|
||||
|
||||
async validate(text: string) {
|
||||
const user = await this.userService.findOneBy({email: text});
|
||||
return !user;
|
||||
}
|
||||
|
||||
defaultMessage(args: ValidationArguments) {
|
||||
return 'User with this email already exists.';
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import { ValidationArguments, ValidatorConstraint } from "class-validator"
|
||||
import { Inject, Injectable } from "@nestjs/common"
|
||||
import { UserService } from "../services/user.service"
|
||||
|
||||
@ValidatorConstraint({ name: 'UsernameAlreadyInUse', async: true })
|
||||
@Injectable()
|
||||
export class UsernameAlreadyInUse {
|
||||
constructor(
|
||||
@Inject('UserService') private readonly userService: UserService,
|
||||
) {}
|
||||
|
||||
async validate(text: string) {
|
||||
const user = await this.userService.findOneBy({username: text});
|
||||
return !user;
|
||||
}
|
||||
|
||||
defaultMessage(args: ValidationArguments) {
|
||||
return 'User with this username already exists.';
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es2017",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"incremental": true
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
{
|
||||
"defaultSeverity": "error",
|
||||
"extends": [
|
||||
"tslint:recommended"
|
||||
],
|
||||
"jsRules": {
|
||||
"no-unused-expression": true
|
||||
},
|
||||
"rules": {
|
||||
"eofline": false,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"indent": false,
|
||||
"member-access": [
|
||||
false
|
||||
],
|
||||
"ordered-imports": [
|
||||
false
|
||||
],
|
||||
"max-line-length": [
|
||||
true,
|
||||
150
|
||||
],
|
||||
"member-ordering": [
|
||||
false
|
||||
],
|
||||
"curly": false,
|
||||
"interface-name": [
|
||||
false
|
||||
],
|
||||
"array-type": [
|
||||
false
|
||||
],
|
||||
"no-empty-interface": false,
|
||||
"no-empty": false,
|
||||
"arrow-parens": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"no-unused-expression": false,
|
||||
"max-classes-per-file": [
|
||||
false
|
||||
],
|
||||
"variable-name": [
|
||||
false
|
||||
],
|
||||
"one-line": [
|
||||
false
|
||||
],
|
||||
"one-variable-per-declaration": [
|
||||
false
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-postbrace"
|
||||
]
|
||||
},
|
||||
"rulesDirectory": []
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
Password Reset Request
|
||||
---
|
||||
Hi,
|
||||
|
||||
if you have not requested a new password you can ignore this email. To set a new password for your account
|
||||
just follow this link: {{ recover }}
|
||||
|
||||
See you soon
|
||||
---
|
||||
<h1>Hi, </h1>
|
||||
|
||||
<p>
|
||||
if you have not requested a new password you can ignore this email. To set a new password for your account
|
||||
just follow this link: <a href="{{ recover }}">{{ recover }}</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
See you soon
|
||||
</p>
|
||||
@ -1,14 +0,0 @@
|
||||
Welcome to OhMyForm
|
||||
---
|
||||
Welcome to OhMyForm!
|
||||
|
||||
please confirm your account by following the following link: {{ confirm }}
|
||||
|
||||
enjoy!
|
||||
---
|
||||
<h1>Welcome to OhMyForm!</h1>
|
||||
<p>
|
||||
please confirm your account by following the following link: <a href="{{ confirm }}">{{ confirm }}</a>
|
||||
</p>
|
||||
|
||||
<p>enjoy!</p>
|
||||
74
app.json
Normal file
74
app.json
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "ohmyform",
|
||||
"description": "Opensource alternative to TypeForm",
|
||||
"repository": "https://github.com/ohmyform/ohmyform",
|
||||
"logo": "https://raw.githubusercontent.com/ohmyform/ohmyform/master/public/logo.png",
|
||||
"keywords": [
|
||||
"form",
|
||||
"survey"
|
||||
],
|
||||
"env": {
|
||||
"BASE_URL": {
|
||||
"description": "Domain name where the site will be hosted",
|
||||
"value": "ohmyform.herokuapp.com"
|
||||
},
|
||||
"MAILER_URI": {
|
||||
"description": "Set this to a uri like smtp://localhost:1025 - for more information check https://nodemailer.com/",
|
||||
"value": "smtp://smtp.mailtrap.io:2525"
|
||||
},
|
||||
"MAILER_FROM": {
|
||||
"description": "Email address from which signup/verifications are sent",
|
||||
"value": "OhMyForm <no-reply@localhost>"
|
||||
},
|
||||
"CREATE_ADMIN": {
|
||||
"description": "Use this to automatically create an admin user on startup",
|
||||
"value": "TRUE"
|
||||
},
|
||||
"ADMIN_EMAIL": {
|
||||
"description": "The email address used by your default admin account",
|
||||
"value": ""
|
||||
},
|
||||
"ADMIN_USERNAME": {
|
||||
"description": "Username of your default admin account",
|
||||
"value": "admin"
|
||||
},
|
||||
"LOGIN_NOTE": {
|
||||
"description": "Note next to login form",
|
||||
"value": "Welcome to your new OhMyForm instance, you can remove this login note in the dyno configuration!"
|
||||
},
|
||||
"ADMIN_PASSWORD": {
|
||||
"description": "Password for your default admin account",
|
||||
"value": ""
|
||||
},
|
||||
"SECRET_KEY": {
|
||||
"description": "Database secret",
|
||||
"generator": "secret"
|
||||
},
|
||||
"NODE_ENV": {
|
||||
"description": "Node environment (production or development)",
|
||||
"value": "production"
|
||||
},
|
||||
"NPM_CONFIG_PRODUCTION": {
|
||||
"description": "Allow Dev Dependencies so we can compile typescript",
|
||||
"value": "false"
|
||||
},
|
||||
"DATABASE_DRIVER": {
|
||||
"description": "Database Driver to use",
|
||||
"value": "postgres"
|
||||
},
|
||||
"DATABASE_SSL": {
|
||||
"description": "Use SSL Connection for database",
|
||||
"value": "true"
|
||||
}
|
||||
},
|
||||
"addons": [
|
||||
"heroku-postgresql",
|
||||
"heroku-redis",
|
||||
"mailtrap"
|
||||
],
|
||||
"buildpacks": [
|
||||
{
|
||||
"url": "heroku/nodejs"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../../config/config');
|
||||
|
||||
/**cd
|
||||
* Module dependencies.
|
||||
*/
|
||||
exports.index = function(req, res) {
|
||||
res.render('index', {
|
||||
user: req.user || null,
|
||||
request: req
|
||||
});
|
||||
};
|
||||
|
||||
exports.form = function(req, res) {
|
||||
|
||||
//Allow form to be embedded
|
||||
res.removeHeader('X-Frame-Options');
|
||||
|
||||
res.render('form', {
|
||||
user: req.user || null,
|
||||
request: req
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
exports.redoc = function(req, res) {
|
||||
res.render('redoc', {
|
||||
request: req
|
||||
});
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user