Skip to content

Commit 75e28a1

Browse files
committed
Merge branch 't216-refactor-common' into 'frontend-next'
T216 refactor common See merge request !5
2 parents b3ed444 + c0e8306 commit 75e28a1

14 files changed

Lines changed: 45 additions & 69 deletions

File tree

.eslintrc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
],
1717
"array-callback-return": "error",
1818
"arrow-body-style": "error",
19-
"arrow-parens": "error",
2019
"arrow-spacing": "error",
2120
"block-scoped-var": "off",
2221
"block-spacing": "error",
@@ -123,7 +122,7 @@
123122
"no-extend-native": "error",
124123
"no-extra-bind": "error",
125124
"no-extra-label": "error",
126-
"no-extra-parens": "error",
125+
"no-extra-parens": "warn",
127126
"no-floating-decimal": "error",
128127
"no-global-assign": "error",
129128
"no-implicit-coercion": "error",
@@ -195,7 +194,7 @@
195194
"no-unneeded-ternary": "error",
196195
"no-unsafe-negation": "error",
197196
"no-unused-expressions": "error",
198-
"no-use-before-define": "error",
197+
"no-use-before-define": "warn",
199198
"no-useless-call": "error",
200199
"no-useless-computed-key": "error",
201200
"no-useless-concat": "error",

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ backups/
1818

1919
# ignore config files
2020
config.json
21-
public/js/config.js
2221
.sequelizerc
2322

2423
# ignore webpack build

README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,9 @@ Configuration files
9797
There are some configs you need to change in the files below
9898

9999
```
100-
./config.json --- for server settings
101-
./public/js/config.js --- for client settings
100+
./config.json ----application settings
102101
```
103102

104-
Client settings `config.js`
105-
---
106-
107-
| variables | example values | description |
108-
| --------- | ------ | ----------- |
109-
| debug | `true` or `false` | set debug mode, show more logs |
110-
| domain | `localhost` | domain name |
111-
| urlpath | `hackmd` | sub url path, like: `www.example.com/<urlpath>` |
112-
113103
Environment variables (will overwrite other server configs)
114104
---
115105

@@ -158,7 +148,7 @@ Environment variables (will overwrite other server configs)
158148
| HMD_S3_REGION | `ap-northeast-1` | AWS S3 region |
159149
| HMD_S3_BUCKET | no example | AWS S3 bucket name |
160150

161-
Server settings `config.json`
151+
Application settings `config.json`
162152
---
163153

164154
| variables | example values | description |
@@ -207,7 +197,7 @@ Third-party integration api key settings
207197
| ------- | --------- | ----------- |
208198
| facebook, twitter, github, gitlab, dropbox, google, ldap | environment variables or `config.json` | for signin |
209199
| imgur | environment variables or `config.json` | for image upload |
210-
| google drive, dropbox | `public/js/config.js` | for export and import |
200+
| google drive(`google/apiKey`, `google/clientID`), dropbox(`dropbox/appKey`) | `config.json` | for export and import |
211201

212202
Third-party integration oauth callback urls
213203
---

bin/heroku

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ EOF
2828
2929
EOF
3030

31-
cp public/js/config.js.example public/js/config.js
32-
3331
# build app
3432
npm run build
3533
fi

bin/setup

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ if [ ! -f config.json ]; then
2121
cp config.json.example config.json
2222
fi
2323

24-
if [ ! -f publis/js/config.js ]; then
25-
cp public/js/config.js.example public/js/config.js
26-
fi
27-
2824
if [ ! -f .sequelizerc ]; then
2925
cp .sequelizerc.example .sequelizerc
3026
fi

config.json.example

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@
4545
},
4646
"dropbox": {
4747
"clientID": "change this",
48-
"clientSecret": "change this"
48+
"clientSecret": "change this",
49+
"appKey": "change this"
4950
},
5051
"google": {
5152
"clientID": "change this",
52-
"clientSecret": "change this"
53+
"clientSecret": "change this",
54+
"apiKey": "change this"
5355
},
5456
"ldap": {
5557
"url": "ldap://change_this",

lib/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ var gitlab = (process.env.HMD_GITLAB_CLIENTID && process.env.HMD_GITLAB_CLIENTSE
9090
var dropbox = (process.env.HMD_DROPBOX_CLIENTID && process.env.HMD_DROPBOX_CLIENTSECRET) ? {
9191
clientID: process.env.HMD_DROPBOX_CLIENTID,
9292
clientSecret: process.env.HMD_DROPBOX_CLIENTSECRET
93-
} : config.dropbox || false;
93+
} : (config.dropbox && config.dropbox.clientID && config.dropbox.clientSecret) || false;
9494
var google = (process.env.HMD_GOOGLE_CLIENTID && process.env.HMD_GOOGLE_CLIENTSECRET) ? {
9595
clientID: process.env.HMD_GOOGLE_CLIENTID,
9696
clientSecret: process.env.HMD_GOOGLE_CLIENTSECRET
97-
} : config.google || false;
97+
} : (config.google && config.google.clientID && config.google.clientSecret) || false;
9898
var ldap = config.ldap || (
9999
process.env.HMD_LDAP_URL ||
100100
process.env.HMD_LDAP_BINDDN ||

public/js/config.js.example

Lines changed: 0 additions & 11 deletions
This file was deleted.

public/js/cover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
getLoginState,
1010
resetCheckAuth,
1111
setloginStateChangeEvent
12-
} from './common';
12+
} from './lib/common/login';
1313

1414
import {
1515
clearDuplicatedHistory,

public/js/extra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import PDFObject from 'pdfobject';
1111
import S from 'string';
1212
import { saveAs } from 'file-saver';
1313

14-
require('./common');
14+
require('./lib/common/login');
1515
require('../vendor/md-toc');
1616
var Viz = require("viz.js");
1717

0 commit comments

Comments
 (0)