Skip to content

Commit 0a25b5c

Browse files
authored
Merge pull request #1921 from hackmdio/release/2.6.0
Release 2.6.0
2 parents da511d0 + 3d74608 commit 0a25b5c

File tree

36 files changed

+3468
-595
lines changed

36 files changed

+3468
-595
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# [Choice] Node.js version: 16, 14
2-
ARG VARIANT=14-buster
2+
ARG VARIANT=14-bullseye
33
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
44

55
# [Optional] Uncomment this section to install additional OS packages.

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
context: ..
77
dockerfile: .devcontainer/Dockerfile
88
args:
9-
VARIANT: 14-buster
9+
VARIANT: 14-bullseye
1010
environment:
1111
- CMD_DB_URL=postgres://codimd:codimd@localhost/codimd
1212
- CMD_USECDN=false

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
node-version: [14.x, 16.x]
13+
node-version: [16.x]
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717

1818
# from https://stackoverflow.com/a/69649733
1919
- name: Reconfigure git to use HTTP authentication
2020
run: >
2121
git config --global url."https://github.com/".insteadOf
2222
ssh://git@github.com/
2323
24-
- uses: actions/cache@v2
24+
- uses: actions/cache@v4
2525
with:
2626
path: ~/.npm
2727
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2828
restore-keys: |
2929
${{ runner.os }}-node-
3030
31-
- uses: actions/setup-node@v2
31+
- uses: actions/setup-node@v4
3232
name: Use Node.js ${{ matrix.node-version }}
3333
with:
3434
node-version: ${{ matrix.node-version }}
@@ -43,8 +43,8 @@ jobs:
4343
if: github.ref == 'refs/heads/master' || github.event.pull_request
4444

4545
steps:
46-
- uses: actions/checkout@v2
47-
- uses: actions/setup-node@v2
46+
- uses: actions/checkout@v4
47+
- uses: actions/setup-node@v4
4848
name: Use Node.js 14
4949
with:
5050
node-version: 14

.github/workflows/check-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919

FUNDING.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"drips": {
3+
"ethereum": {
4+
"ownedBy": "0xEd37B84FD84A834886aC07693aF6A9cd35040002"
5+
}
6+
}
7+
}

deployments/docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ services:
1212
codimd:
1313
# you can use image or custom build below,
1414
image: nabo.codimd.dev/hackmdio/hackmd:2.5.3
15+
# Using the following command to trigger the build
16+
# docker-compose -f deployments/docker-compose.yml up --build
1517
# build:
1618
# context: ..
1719
# dockerfile: ./deployments/Dockerfile
20+
# args:
21+
# RUNTIME: hackmdio/runtime:16.20.2-35fe7e39
22+
# BUILDPACK: hackmdio/buildpack:16.20.2-35fe7e39
1823
environment:
1924
- CMD_DB_URL=postgres://codimd:change_password@database/codimd
2025
- CMD_USECDN=false

lib/auth/bitbucket/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const bitbucketAuth = module.exports = Router()
1111
passport.use(new BitbucketStrategy({
1212
clientID: config.bitbucket.clientID,
1313
clientSecret: config.bitbucket.clientSecret,
14-
callbackURL: config.serverURL + '/auth/bitbucket/callback'
14+
callbackURL: config.serverURL + '/auth/bitbucket/callback',
15+
state: true
1516
}, passportGeneralCallback))
1617

1718
bitbucketAuth.get('/auth/bitbucket', function (req, res, next) {

lib/auth/dropbox/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ passport.use(new DropboxStrategy({
1212
apiVersion: '2',
1313
clientID: config.dropbox.clientID,
1414
clientSecret: config.dropbox.clientSecret,
15-
callbackURL: config.serverURL + '/auth/dropbox/callback'
15+
callbackURL: config.serverURL + '/auth/dropbox/callback',
16+
state: true
1617
}, passportGeneralCallback))
1718

1819
dropboxAuth.get('/auth/dropbox', function (req, res, next) {

lib/auth/email/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const Router = require('express').Router
44
const passport = require('passport')
5+
const sequelize = require('sequelize')
56
const validator = require('validator')
67
const LocalStrategy = require('passport-local').Strategy
78
const config = require('../../config')
@@ -21,7 +22,10 @@ passport.use(new LocalStrategy({
2122
try {
2223
const user = await models.User.findOne({
2324
where: {
24-
email: email
25+
email: sequelize.where(
26+
sequelize.fn('LOWER', sequelize.col('email')),
27+
email.toLowerCase()
28+
)
2529
}
2630
})
2731

lib/auth/facebook/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const facebookAuth = module.exports = Router()
1212
passport.use(new FacebookStrategy({
1313
clientID: config.facebook.clientID,
1414
clientSecret: config.facebook.clientSecret,
15-
callbackURL: config.serverURL + '/auth/facebook/callback'
15+
callbackURL: config.serverURL + '/auth/facebook/callback',
16+
state: true
1617
}, passportGeneralCallback))
1718

1819
facebookAuth.get('/auth/facebook', function (req, res, next) {

lib/auth/github/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ passport.use(new GithubStrategy({
2626
callbackURL: config.serverURL + '/auth/github/callback',
2727
authorizationURL: githubUrl('login/oauth/authorize'),
2828
tokenURL: githubUrl('login/oauth/access_token'),
29-
userProfileURL: githubUrl('api/v3/user')
29+
userProfileURL: githubUrl('api/v3/user'),
30+
state: true
3031
}, async (accessToken, refreshToken, profile, done) => {
3132
if (!config.github.organizations) {
3233
return passportGeneralCallback(accessToken, refreshToken, profile, done)

lib/auth/gitlab/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const gitlabAuthStrategy = new GitlabStrategy({
1515
clientID: config.gitlab.clientID,
1616
clientSecret: config.gitlab.clientSecret,
1717
scope: config.gitlab.scope,
18-
callbackURL: config.serverURL + '/auth/gitlab/callback'
18+
callbackURL: config.serverURL + '/auth/gitlab/callback',
19+
state: true
1920
}, passportGeneralCallback)
2021

2122
if (process.env.https_proxy) {

lib/auth/google/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ passport.use(new GoogleStrategy({
1212
clientID: config.google.clientID,
1313
clientSecret: config.google.clientSecret,
1414
callbackURL: config.serverURL + '/auth/google/callback',
15-
userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo'
15+
userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo',
16+
state: true
1617
}, passportGeneralCallback))
1718

1819
googleAuth.get('/auth/google', function (req, res, next) {

lib/auth/twitter/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const twitterAuth = module.exports = Router()
1212
passport.use(new TwitterStrategy({
1313
consumerKey: config.twitter.consumerKey,
1414
consumerSecret: config.twitter.consumerSecret,
15-
callbackURL: config.serverURL + '/auth/twitter/callback'
15+
callbackURL: config.serverURL + '/auth/twitter/callback',
16+
state: true
1617
}, passportGeneralCallback))
1718

1819
twitterAuth.get('/auth/twitter', function (req, res, next) {

lib/config/default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ module.exports = {
7474
accessKeyId: undefined,
7575
secretAccessKey: undefined,
7676
region: undefined,
77-
endpoint: undefined
77+
endpoint: undefined,
78+
baseURL: undefined
7879
},
7980
minio: {
8081
accessKey: undefined,

lib/config/environment.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ module.exports = {
4444
accessKeyId: process.env.CMD_S3_ACCESS_KEY_ID,
4545
secretAccessKey: process.env.CMD_S3_SECRET_ACCESS_KEY,
4646
region: process.env.CMD_S3_REGION,
47-
endpoint: process.env.CMD_S3_ENDPOINT
47+
endpoint: process.env.CMD_S3_ENDPOINT,
48+
baseURL: process.env.CMD_S3_BASEURL
4849
},
4950
minio: {
5051
accessKey: process.env.CMD_MINIO_ACCESS_KEY,

lib/imageRouter/s3.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,17 @@ exports.uploadImage = function (imagePath, callback) {
5151
// default scheme settings to https
5252
let s3Endpoint = 'https://s3.amazonaws.com'
5353
if (config.s3.region && config.s3.region !== 'us-east-1') {
54-
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
54+
s3Endpoint = `https://s3-${config.s3.region}.amazonaws.com`
5555
}
5656
// rewrite endpoint from config
5757
if (config.s3.endpoint) {
5858
s3Endpoint = config.s3.endpoint
5959
}
60-
callback(null, `${s3Endpoint}/${config.s3bucket}/${params.Key}`)
60+
if (config.s3.baseURL) {
61+
callback(null, `${config.s3.baseURL}/${params.Key}`)
62+
} else {
63+
callback(null, `${s3Endpoint}/${config.s3bucket}/${params.Key}`)
64+
}
6165
}).catch(err => {
6266
if (err) {
6367
callback(new Error(err), null)

0 commit comments

Comments
 (0)