Commit graph

675 commits

Author SHA1 Message Date
Philip Molares
be65042792
added auth/index.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:12 +02:00
Yannick Bungers
1b7cfe64eb
Fixed wrong import
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:12 +02:00
Philip Molares
a642cfd22a
fixed bug with minio.ts
- the provider can't be meaningfully initialized if this UploadProvider is not configured

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Yannick Bungers
6cbd436454
Refactored middleware -> Typescript
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Philip Molares
a36c36d86a
removed AuthProvider
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Philip Molares
c49039c48c
removed Utils import and added individual method import instead
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Philip Molares
3b36e2e0e6
fixed lib/web/note/router.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Philip Molares
46774282cc
worked on realtime.ts
- added named export
- sock.disconnect() has no argument

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Philip Molares
9afc2e19a4
worked on app.ts
- fixed imports
- used lib/web/index.ts instead of importing all over the place

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:11 +02:00
Philip Molares
823bd5e432
added lib/web/index.ts to let others import all the routers from one place
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Philip Molares
d4dc9a4046
added statusRouter.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Philip Molares
fd57ed19c2
added historyRouter.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Philip Molares
621905bc97
added baseRouter.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Yannick Bungers
c4178e5d77
changed path dmpWorker.js -> dmpWorker.ts
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Yannick Bungers
8ed198ffcb
Migrate dmpWorker to TypeScript
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Philip Molares
41726949e8
not specified errors should be undefined and not null in UploadProvider
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:10 +02:00
Philip Molares
982bbe9728
rewrote ImageRouter
- introduced UploadProvider interface
- rewrote all current UploadProviders

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:09 +02:00
Philip Molares
b841b1ca4c
fixed lib/utils.ts
- added more return types
- removed module wrapper

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:09 +02:00
Philip Molares
5c8541e65d
changed imageUploadType to an UnionType of all the possible uploadTypes
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:09 +02:00
Yannick Bungers
a191448b3d
Added Types revision.ts
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:09 +02:00
Yannick Bungers
6d256dd5b6
Added Types for csp.ts
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:09 +02:00
David Mehren
9b323ba996
config/index.ts: Use const where possible, use new config type definition
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
1437cf3ea5
config/enum.ts: Refactor enums into interface and object
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
37c2cd0731
config/: Cleanups in defaultSSL.ts and dockerSecret.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
ad0b0834e5
config/default.ts: Add missing attributes, cleanup superfluous attributes
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
5ec041d22d
Add type definitions for config
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
3389a86689
config/utils.ts: toBooleanConfig can return undefined
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
943ddc4058
realtime.ts: Fix history import
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:08 +02:00
David Mehren
038db39c0e
Fix missing newlines in actions.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
David Mehren
df94e0a64f
Fix type in csp.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
David Mehren
d44144630f
Migrate historyRouter.js and baseRouter.js to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
David Mehren
0ca8e2dc7d
Fix error import
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
Yannick Bungers
dd4ea6f488
Added Types to actions.js and reformat
Added Types to actions.js and reformat

Readded csp.ts

Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
Philip Molares
8b9c639e89
created error.ts
- moved export
- fixed function order
- errorServiceUnavailable now uses responseError like everything else

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
Philip Molares
6601ac76b5
worked on response.ts
- renamed unused arguments to '_'
- fixed noteUtil call
- moved export of response to the end of the file

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:07 +02:00
Philip Molares
57675265fc
removed 'use-strict'
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:06 +02:00
Philip Molares
d0b693d3e7
updated types in note.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:06 +02:00
Philip Molares
a7aaded6dd
created history.ts
- fixed imports
- added HistoryObject type
- made parseNoteInfo in note.ts static

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:06 +02:00
Yannick Bungers
8e76c764e3
Added Types to actions.js and reformat
Added Types to actions.js and reformat

Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:06 +02:00
Yannick Bungers
536c54ff0d
moved response.js to response.ts and readded missing return statements
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:06 +02:00
Yannick Bungers
bb8fb93fee
Moved utils.js to utils.ts and refactored import and exports
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:06 +02:00
David Mehren
3340780157
Migrate config templates to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:05 +02:00
David Mehren
e641681483
ESLint fixes in models
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:05 +02:00
David Mehren
9f284b752b
Use import syntax for logger and config
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:05 +02:00
David Mehren
dd11483f44
Migrate config/index.js to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
Philip Molares
637833ab18
created logger.ts
moved the added stream part directly into the config of morgan in app.ts.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
Yannick Bungers
bb8297dca3
Added Types to actions.js and reformat
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
Philip Molares
f9193822a7
created letter-avatars.ts
added @types/randomcolor

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
David Mehren
7cdcf627db
note.ts: ESLint fixes, add types for diff-match-patch
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
David Mehren
f8eb958f16
realtime.ts: Many ESLint fixes
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
Yannick Bungers
de09524658
Added Types and reformating code
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:04 +02:00
Yannick Bungers
84e021a0b0
Added types
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:03 +02:00
Yannick Bungers
c6655d767a
changed for loop to foreach
Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:03 +02:00
Philip Molares
4eb71d6cad
reworked user.ts
- fixed imports
- removed complicated ternary operators
- simplified parseProfile
- added enum ProviderEnum
- added type Profile
- added type PhotoProfile

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:03 +02:00
Philip Molares
22683451bd
changed imports to new ./modules import style
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:03 +02:00
Philip Molares
d278a106e8
added model exports in index.ts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:02 +02:00
David Mehren
77e84a18ee
Migrate realtime.js to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:02 +02:00
David Mehren
0ad30a0029
revision.ts: Formatting, use Utils instead of global Sequelize object
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:02 +02:00
David Mehren
477a37b48c
note.ts: Formatting, use Utils instead of global Sequelize object
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:02 +02:00
David Mehren
522d92a9a1
app.ts: Use let/const instead of var, fix sequelize import
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:02 +02:00
David Mehren
8c662a1f41
Move stripNullByte and processData from models/index.ts to utils.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:02 +02:00
David Mehren
03ae37055d
Migrate utils.js to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:01 +02:00
David Mehren
e87c8f04e5
Migrate app.js to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:01 +02:00
David Mehren
77e336dfda
Various refactors to use the new models
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:01 +02:00
David Mehren
4e02f46cee
More static methods in revision.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:01 +02:00
David Mehren
0c078f5266
Fix types for foreign keys
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:01 +02:00
David Mehren
1d4107fe90
Migrate models to TypeScript
Co-authored-by: David Mehren <dmehren1@gmail.com>
Co-authored-by: Yannick Bungers <git@innay.de>
Co-authored-by: Philipp Hochkamp <me@phochkamp.de>
Co-authored-by: nzbr <mail@nzbr.de>

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-04-25 16:04:01 +02:00
Erik Michelson
7838f9b03a
Added config property for locales
There's a new config property 'localesPath' - pointing to './locales' by default. The path resolution is similar to the docsPath, uploadsPath etc.

Signed-off-by: Erik Michelson <erik@liltv.de>
2020-04-24 19:09:18 +02:00
Erik Michelson
760591b9b0
Fixed wrong locales search path after app.js move
Signed-off-by: Erik Michelson <erik@liltv.de>
2020-04-24 16:42:03 +02:00
Sheogorath
d2ace4b2a0
Merge pull request #330 from Skgland/master
Pass through ldap starttls option
2020-04-23 23:34:46 +02:00
Sheogorath
4104f9835d
Merge pull request #278 from elespike/master
Add OIDC scopes for email & profile retrieval
2020-04-22 20:56:58 +02:00
Bennet Bleßmann
5fad6a25a8
Pass through ldap starttls option
Fixing Issue #329

(cherry picked from commit b9169eb279020f21b372a843a83c71929fb6fd1d)

Signed-off-by: Bennet Bleßmann <bb-github@t-online.de>
2020-04-20 10:55:50 +02:00
Sheogorath
b3249d9175
Limit DB schema changes to migrations
Database migrations should be in charge of changing and modifying the
database schema. Therefore this breaking change removes the automatic
model synchronisation from the application startup, that we have
practised way too long and that always caused problems for us.

References:
https://sequelize.org/v5/manual/getting-started.html#note-for-production
81e3d7bd00
f85ba6df53

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-04-16 16:20:11 +02:00
Charles Parmentier
856fc01fb9 Fixes relative path for fetching the style when set
Signed-off-by: Charles Parmentier <charles.parmentier@hotmail.com>
2020-03-06 00:09:54 +01:00
Sheogorath
97628595ed
Fix unsused import of fs
Let's make the CI happy again :-)

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-26 15:11:24 +01:00
Sheogorath
a2522888b2
Remove PDF export
As we already decleared in earlier versions, this patch removes PDF
export entirely. It's a not acceptable security risk for every CodiMD
instance.

The current implementation allowed to extract arbitary files from the
CodiMD host and therefore leaking secrets from a `/etc/passwd` to
CodiMD's own config files and all secrets contained in it.

Thanks to Joona for finding this vulnerability in August last year,
which lead to an emergency disabling of PDF exports in 1.5.0.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-26 15:05:54 +01:00
Sheogorath
37923d11f8
Rewrite slide controller to TypeScript
Before this patch the non-TypeScript version of the slide mode causes
problems with the TypeScript code. Therefore, in order to get things
working, this patch does minimalistic changes to the slide mode
controller to bring it into TypeScript convention. And unbreak slide
mode. Further changes are required, but this gets slide mode back to a
usable state.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-26 15:05:51 +01:00
Erik Michelson
c976217c12
Remove mattermost integration
Signed-off-by: Erik Michelson <erik@liltv.de>
2020-02-25 14:33:30 +01:00
Sheogorath
95355b8f01
Fix broken assets
Since switching to TypeScript our assets are broken due to the move of
app.js to the `./lib` subdirectory and the relative patch specified for
the public directory.

This patch solves the problem by adding a proper config element for the
path and referencing it in `./lib/app.js`.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-25 11:21:48 +01:00
Sheogorath
004e2fbcb2
TypeScript: Tighten configs to improve type validation
TypeScript considers null and undefined as fine for all variable by
default. This patch enables `strictNullChecks`, which should cause
errors to be thrown as soon as a variable is null or undefined without
having it explicitly decleared for itself.[1]

[1]: https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#strict-null--undefined-checks

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-24 16:19:17 +01:00
David Mehren
f0b1d85ae9
Fix typo in Author model
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-02-24 15:08:27 +01:00
David Mehren
f6eec0ce90
Convert first files to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-02-24 15:08:23 +01:00
David Mehren
63095e6c78
Move app.js to lib
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-02-24 15:07:07 +01:00
Marius
574781ed6e Add environment variables and doc entries
Signed-off-by: Marius <elespike@lab26.net>
2020-02-22 00:16:26 -05:00
Marius
6332fce5d8 Add OIDC scopes for email & profile retrieval
Signed-off-by: Marius <elespike@lab26.net>
2020-02-22 00:16:16 -05:00
Sheogorath
651db60985
Update CDN defaults
As we noticed in our poll about CDN usage, that most people
intentionally turn it off, but very little intetionally turn it on or
leave it on. [1]

There is also strong indicators that CDNs don't really provide any
benefits in loading time and due to the small deployments of CodiMD,
there is no big savings due to CDNs either. [2]

Therefore this patch changes the CDN default settings to off in order to
reduce the exposed user data.

[1]: https://community.codimd.org/t/poll-on-cdn-usage/28
[2]: https://csswizardry.com/2019/05/self-host-your-static-assets/

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-09 21:59:17 +01:00
ike
197223dc81 Add Google oauth variable: hostedDomain
Which is part of `passport-google-oauth2`.
It could be used as whitelist to a domain supported by google oauth.
Ref: https://github.com/jaredhanson/passport-google-oauth2/issues/3

Signed-off-by: ike <developer@ikewat.com>
2020-02-08 15:57:22 +08:00
Sheogorath
b3d4cdbceb
Update RevealJS to version 3.9.2
This update of revealJS helps us to get rid of the headjs depedency
integration using webpack. It updates reveal.js to 3.9.2 and updates the
csp hash accordingly for using the slide mode.

Background for this update is the critical security vulnerability
described by snyk in their disclosure:
https://snyk.io/vuln/SNYK-JS-REVEALJS-543841

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2020-02-01 12:53:15 +01:00
Sheogorath
33150b79c7
Merge pull request #218 from hoijui/linkifyHeaderStyle
Linkify header style
2019-12-03 14:40:00 +01:00
Ralph Krimmel
9534cdafbf Making the linter happy by removing superfluous ;
Signed-off-by: Ralph Krimmel <rkrimme1@gwdg.de>
2019-11-28 14:00:34 +01:00
Ralph Krimmel
3fb3ca54e9 Removing returnTo setting from referer in all other authentication sources
Signed-off-by: Ralph Krimmel <rkrimme1@gwdg.de>
2019-11-28 12:25:59 +01:00
Ralph Krimmel
e0a8872742 Moving the storage of referrer information to main authorization check instead of doing it in the authentication source
Signed-off-by: Ralph Krimmel <rkrimme1@gwdg.de>
2019-11-28 10:59:59 +01:00
Ralph Krimmel
3e8cf5778f Fixing linting problems
Signed-off-by: Ralph Krimmel <rkrimme1@gwdg.de>
2019-11-27 15:17:00 +01:00
foobarable
1881775379 Fixing redirection after SAML login
Saving referer into session in SAML auth so passport can redirect correctly after SAML login.

Signed-off-by: Ralph Krimmel <rkrimme1@gwdg.de>
2019-11-27 15:08:30 +01:00
Sheogorath
689f5a0a95
Merge pull request #213 from davidmehren/refactor_backend_notes
First steps in refactoring the backend code
2019-11-20 20:07:35 +01:00
hoijui
e1ff73877b allow to define header link generation style via environment var
Signed-off-by: hoijui <hoijui.quaero@gmail.com>
2019-10-30 17:46:38 +01:00
hoijui
cfa2ec38c5 document linkifyHeaderStyle in default.js
Signed-off-by: hoijui <hoijui.quaero@gmail.com>
2019-10-30 17:46:17 +01:00
Girish Ramakrishnan
c034ee5571 Fix crash in lutim integration
Signed-off-by: Girish Ramakrishnan <girish@cloudron.io>
2019-10-29 20:23:13 -07:00
David Mehren
b5ccceff59
Inline renderPublishSlide
Signed-off-by: David Mehren <dmehren1@gmail.com>
2019-10-27 15:50:24 +01:00
David Mehren
3c39d07723
Inline responseCodiMD
Signed-off-by: David Mehren <dmehren1@gmail.com>
2019-10-27 15:29:10 +01:00