mirror of
https://github.com/requarks/wiki.git
synced 2026-08-26 05:07:30 -05:00
refactor: update docker images to Node 24 and fix promisify calls
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# ====================
|
# ====================
|
||||||
# --- Build Assets ---
|
# --- Build Assets ---
|
||||||
# ====================
|
# ====================
|
||||||
FROM node:20-alpine AS assets
|
FROM node:24-alpine AS assets
|
||||||
|
|
||||||
RUN apk add yarn g++ make cmake python3 --no-cache
|
RUN apk add yarn g++ make cmake python3 --no-cache
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ RUN yarn patch-package
|
|||||||
# ===============
|
# ===============
|
||||||
# --- Release ---
|
# --- Release ---
|
||||||
# ===============
|
# ===============
|
||||||
FROM node:20-alpine
|
FROM node:24-alpine
|
||||||
LABEL maintainer="requarks.io"
|
LABEL maintainer="requarks.io"
|
||||||
|
|
||||||
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \
|
RUN apk add bash curl git openssh gnupg sqlite --no-cache && \
|
||||||
@@ -53,4 +53,4 @@ EXPOSE 3443
|
|||||||
|
|
||||||
# HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl -f http://localhost:3000/healthz
|
# HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl -f http://localhost:3000/healthz
|
||||||
|
|
||||||
CMD ["node", "server"]
|
CMD ["node", "--no-deprecation", "server"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# -- DEV DOCKERFILE --
|
# -- DEV DOCKERFILE --
|
||||||
# -- DO NOT USE IN PRODUCTION! --
|
# -- DO NOT USE IN PRODUCTION! --
|
||||||
|
|
||||||
FROM node:18
|
FROM node:24
|
||||||
LABEL maintainer "requarks.io"
|
LABEL maintainer "requarks.io"
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ version: "3"
|
|||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
container_name: wiki-db
|
container_name: wiki-db
|
||||||
image: postgres:15-alpine
|
image: postgres:17-alpine
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: wiki
|
POSTGRES_DB: wiki
|
||||||
POSTGRES_PASSWORD: wikijsrocks
|
POSTGRES_PASSWORD: wikijsrocks
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "wiki",
|
"name": "wiki",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"releaseDate": "2019-01-01T01:01:01.000Z",
|
"releaseDate": "2026-01-01T01:01:01.000Z",
|
||||||
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
|
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
|
||||||
"main": "wiki.js",
|
"main": "wiki.js",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/Requarks/wiki#readme",
|
"homepage": "https://github.com/Requarks/wiki#readme",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.12"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/storage-blob": "12.12.0",
|
"@azure/storage-blob": "12.12.0",
|
||||||
|
|||||||
+4
-4
@@ -4,9 +4,9 @@ const _ = require('lodash')
|
|||||||
const jwt = require('jsonwebtoken')
|
const jwt = require('jsonwebtoken')
|
||||||
const ms = require('ms')
|
const ms = require('ms')
|
||||||
const { DateTime } = require('luxon')
|
const { DateTime } = require('luxon')
|
||||||
const Promise = require('bluebird')
|
const crypto = require('crypto')
|
||||||
const crypto = Promise.promisifyAll(require('crypto'))
|
|
||||||
const pem2jwk = require('pem-jwk').pem2jwk
|
const pem2jwk = require('pem-jwk').pem2jwk
|
||||||
|
const randomBytesAsync = require('util').promisify(crypto.randomBytes)
|
||||||
|
|
||||||
const securityHelper = require('../helpers/security')
|
const securityHelper = require('../helpers/security')
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ module.exports = {
|
|||||||
const strategy = require(`../modules/authentication/${stg.strategyKey}/authentication.js`)
|
const strategy = require(`../modules/authentication/${stg.strategyKey}/authentication.js`)
|
||||||
|
|
||||||
stg.config.callbackURL = `${WIKI.config.host}/login/${stg.key}/callback`
|
stg.config.callbackURL = `${WIKI.config.host}/login/${stg.key}/callback`
|
||||||
stg.config.key = stg.key;
|
stg.config.key = stg.key
|
||||||
strategy.init(passport, stg.config)
|
strategy.init(passport, stg.config)
|
||||||
strategy.config = stg.config
|
strategy.config = stg.config
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ module.exports = {
|
|||||||
async regenerateCertificates () {
|
async regenerateCertificates () {
|
||||||
WIKI.logger.info('Regenerating certificates...')
|
WIKI.logger.info('Regenerating certificates...')
|
||||||
|
|
||||||
_.set(WIKI.config, 'sessionSecret', (await crypto.randomBytesAsync(32)).toString('hex'))
|
_.set(WIKI.config, 'sessionSecret', (await randomBytesAsync(32)).toString('hex'))
|
||||||
const certs = crypto.generateKeyPairSync('rsa', {
|
const certs = crypto.generateKeyPairSync('rsa', {
|
||||||
modulusLength: 2048,
|
modulusLength: 2048,
|
||||||
publicKeyEncoding: {
|
publicKeyEncoding: {
|
||||||
|
|||||||
+3
-3
@@ -93,9 +93,9 @@ module.exports = {
|
|||||||
|
|
||||||
// Prune host and port if socketPath is configured
|
// Prune host and port if socketPath is configured
|
||||||
if (WIKI.config.db.socketPath) {
|
if (WIKI.config.db.socketPath) {
|
||||||
const { host, port, ...prunedConfig} = dbConfig
|
const { host, port, ...prunedConfig } = dbConfig
|
||||||
dbConfig = prunedConfig
|
dbConfig = prunedConfig
|
||||||
dbConfig.socketPath = WIKI.config.db.socketPath.toString()
|
dbConfig.socketPath = WIKI.config.db.socketPath.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix mysql boolean handling...
|
// Fix mysql boolean handling...
|
||||||
|
|||||||
+10
-11
@@ -4,8 +4,7 @@ const Promise = require('bluebird')
|
|||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const zlib = require('zlib')
|
const zlib = require('zlib')
|
||||||
const stream = require('stream')
|
const { pipeline, Readable, Transform } = require('stream')
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@@ -121,7 +120,7 @@ module.exports = {
|
|||||||
|
|
||||||
await pipeline(
|
await pipeline(
|
||||||
WIKI.models.knex.select('filename', 'folderId', 'data').from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
WIKI.models.knex.select('filename', 'folderId', 'data').from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (asset, enc, cb) => {
|
transform: async (asset, enc, cb) => {
|
||||||
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
||||||
@@ -150,7 +149,7 @@ module.exports = {
|
|||||||
const commentsProgressMultiplier = progressMultiplier / Math.ceil(commentsCount / 50)
|
const commentsProgressMultiplier = progressMultiplier / Math.ceil(commentsCount / 50)
|
||||||
WIKI.logger.info(`Found ${commentsCount} comments to export. Streaming to file...`)
|
WIKI.logger.info(`Found ${commentsCount} comments to export. Streaming to file...`)
|
||||||
|
|
||||||
const rs = stream.Readable({ objectMode: true })
|
const rs = Readable({ objectMode: true })
|
||||||
rs._read = () => {}
|
rs._read = () => {}
|
||||||
|
|
||||||
const fetchCommentsBatch = async (offset) => {
|
const fetchCommentsBatch = async (offset) => {
|
||||||
@@ -177,7 +176,7 @@ module.exports = {
|
|||||||
let marker = 0
|
let marker = 0
|
||||||
await pipeline(
|
await pipeline(
|
||||||
rs,
|
rs,
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform (chunk, encoding, callback) {
|
transform (chunk, encoding, callback) {
|
||||||
marker++
|
marker++
|
||||||
@@ -225,7 +224,7 @@ module.exports = {
|
|||||||
const pagesProgressMultiplier = progressMultiplier / Math.ceil(pagesCount / 10)
|
const pagesProgressMultiplier = progressMultiplier / Math.ceil(pagesCount / 10)
|
||||||
WIKI.logger.info(`Found ${pagesCount} pages history to export. Streaming to file...`)
|
WIKI.logger.info(`Found ${pagesCount} pages history to export. Streaming to file...`)
|
||||||
|
|
||||||
const rs = stream.Readable({ objectMode: true })
|
const rs = Readable({ objectMode: true })
|
||||||
rs._read = () => {}
|
rs._read = () => {}
|
||||||
|
|
||||||
const fetchPagesBatch = async (offset) => {
|
const fetchPagesBatch = async (offset) => {
|
||||||
@@ -255,7 +254,7 @@ module.exports = {
|
|||||||
let marker = 0
|
let marker = 0
|
||||||
await pipeline(
|
await pipeline(
|
||||||
rs,
|
rs,
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform (chunk, encoding, callback) {
|
transform (chunk, encoding, callback) {
|
||||||
marker++
|
marker++
|
||||||
@@ -307,7 +306,7 @@ module.exports = {
|
|||||||
const pagesProgressMultiplier = progressMultiplier / Math.ceil(pagesCount / 10)
|
const pagesProgressMultiplier = progressMultiplier / Math.ceil(pagesCount / 10)
|
||||||
WIKI.logger.info(`Found ${pagesCount} pages to export. Streaming to file...`)
|
WIKI.logger.info(`Found ${pagesCount} pages to export. Streaming to file...`)
|
||||||
|
|
||||||
const rs = stream.Readable({ objectMode: true })
|
const rs = Readable({ objectMode: true })
|
||||||
rs._read = () => {}
|
rs._read = () => {}
|
||||||
|
|
||||||
const fetchPagesBatch = async (offset) => {
|
const fetchPagesBatch = async (offset) => {
|
||||||
@@ -337,7 +336,7 @@ module.exports = {
|
|||||||
let marker = 0
|
let marker = 0
|
||||||
await pipeline(
|
await pipeline(
|
||||||
rs,
|
rs,
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform (chunk, encoding, callback) {
|
transform (chunk, encoding, callback) {
|
||||||
marker++
|
marker++
|
||||||
@@ -400,7 +399,7 @@ module.exports = {
|
|||||||
const usersProgressMultiplier = progressMultiplier / Math.ceil(usersCount / 50)
|
const usersProgressMultiplier = progressMultiplier / Math.ceil(usersCount / 50)
|
||||||
WIKI.logger.info(`Found ${usersCount} users to export. Streaming to file...`)
|
WIKI.logger.info(`Found ${usersCount} users to export. Streaming to file...`)
|
||||||
|
|
||||||
const rs = stream.Readable({ objectMode: true })
|
const rs = Readable({ objectMode: true })
|
||||||
rs._read = () => {}
|
rs._read = () => {}
|
||||||
|
|
||||||
const fetchUsersBatch = async (offset) => {
|
const fetchUsersBatch = async (offset) => {
|
||||||
@@ -427,7 +426,7 @@ module.exports = {
|
|||||||
let marker = 0
|
let marker = 0
|
||||||
await pipeline(
|
await pipeline(
|
||||||
rs,
|
rs,
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform (chunk, encoding, callback) {
|
transform (chunk, encoding, callback) {
|
||||||
marker++
|
marker++
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const Promise = require('bluebird')
|
const getos = require('getos')
|
||||||
const getos = Promise.promisify(require('getos'))
|
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const filesize = require('filesize')
|
const filesize = require('filesize')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
@@ -11,6 +10,8 @@ const request = require('request-promise')
|
|||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const nanoid = require('nanoid/non-secure').customAlphabet('1234567890abcdef', 10)
|
const nanoid = require('nanoid/non-secure').customAlphabet('1234567890abcdef', 10)
|
||||||
|
|
||||||
|
const getosAsync = require('util').promisify(getos)
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
const dbTypes = {
|
const dbTypes = {
|
||||||
@@ -371,7 +372,7 @@ module.exports = {
|
|||||||
async operatingSystem () {
|
async operatingSystem () {
|
||||||
let osLabel = `${os.type()} (${os.platform()}) ${os.release()} ${os.arch()}`
|
let osLabel = `${os.type()} (${os.platform()}) ${os.release()} ${os.arch()}`
|
||||||
if (os.platform() === 'linux') {
|
if (os.platform() === 'linux') {
|
||||||
const osInfo = await getos()
|
const osInfo = await getosAsync()
|
||||||
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
|
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
|
||||||
}
|
}
|
||||||
return osLabel
|
return osLabel
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const algoliasearch = require('algoliasearch')
|
const algoliasearch = require('algoliasearch')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@@ -192,7 +190,7 @@ module.exports = {
|
|||||||
isPublished: true,
|
isPublished: true,
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (chunk, enc, cb) => processDocument(cb, chunk),
|
transform: async (chunk, enc, cb) => processDocument(cb, chunk),
|
||||||
flush: async (cb) => processDocument(cb)
|
flush: async (cb) => processDocument(cb)
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const AWS = require('aws-sdk')
|
const AWS = require('aws-sdk')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@@ -353,7 +351,7 @@ module.exports = {
|
|||||||
isPublished: true,
|
isPublished: true,
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (chunk, enc, cb) => processDocument(cb, chunk),
|
transform: async (chunk, enc, cb) => processDocument(cb, chunk),
|
||||||
flush: async (cb) => processDocument(cb)
|
flush: async (cb) => processDocument(cb)
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const { SearchService, QueryType } = require('azure-search-client')
|
const { SearchService, QueryType } = require('azure-search-client')
|
||||||
const request = require('request-promise')
|
const request = require('request-promise')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@@ -215,7 +213,7 @@ module.exports = {
|
|||||||
isPublished: true,
|
isPublished: true,
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: (chunk, enc, cb) => {
|
transform: (chunk, enc, cb) => {
|
||||||
cb(null, {
|
cb(null, {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const stream = require('stream')
|
|
||||||
const Promise = require('bluebird')
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
const { pipeline, Transform } = require('stream')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@@ -135,7 +133,7 @@ module.exports = {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err))
|
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Create Index Error: `, _.get(err, 'meta.body.error', err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Index Check Error: `, _.get(err, 'meta.body.error', err))
|
WIKI.logger.error(`(SEARCH/ELASTICSEARCH) Index Check Error: `, _.get(err, 'meta.body.error', err))
|
||||||
}
|
}
|
||||||
@@ -392,7 +390,7 @@ module.exports = {
|
|||||||
isPublished: true,
|
isPublished: true,
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (chunk, enc, cb) => processDocument(cb, chunk),
|
transform: async (chunk, enc, cb) => processDocument(cb, chunk),
|
||||||
flush: async (cb) => processDocument(cb)
|
flush: async (cb) => processDocument(cb)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
const tsquery = require('pg-tsquery')()
|
const tsquery = require('pg-tsquery')()
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@@ -166,7 +164,7 @@ module.exports = {
|
|||||||
isPublished: true,
|
isPublished: true,
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
const content = WIKI.models.pages.cleanHTML(page.render)
|
const content = WIKI.models.pages.cleanHTML(page.render)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
const { BlobServiceClient, StorageSharedKeyCredential } = require('@azure/storage-blob')
|
const { BlobServiceClient, StorageSharedKeyCredential } = require('@azure/storage-blob')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
const pageHelper = require('../../../helpers/page.js')
|
const pageHelper = require('../../../helpers/page.js')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
|
||||||
@@ -129,7 +127,7 @@ module.exports = {
|
|||||||
WIKI.models.knex.column('path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt').select().from('pages').where({
|
WIKI.models.knex.column('path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt').select().from('pages').where({
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
const filePath = getFilePath(page, 'path')
|
const filePath = getFilePath(page, 'path')
|
||||||
@@ -147,7 +145,7 @@ module.exports = {
|
|||||||
|
|
||||||
await pipeline(
|
await pipeline(
|
||||||
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (asset, enc, cb) => {
|
transform: async (asset, enc, cb) => {
|
||||||
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
const klaw = require('klaw')
|
const klaw = require('klaw')
|
||||||
const mime = require('mime-types').lookup
|
const mime = require('mime-types').lookup
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
@@ -22,7 +20,7 @@ module.exports = {
|
|||||||
return !_.includes(f, '.git')
|
return !_.includes(f, '.git')
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (file, enc, cb) => {
|
transform: async (file, enc, cb) => {
|
||||||
const relPath = file.path.substr(fullPath.length + 1)
|
const relPath = file.path.substr(fullPath.length + 1)
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ const fs = require('fs-extra')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const tar = require('tar-fs')
|
const tar = require('tar-fs')
|
||||||
const zlib = require('zlib')
|
const zlib = require('zlib')
|
||||||
const stream = require('stream')
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const Promise = require('bluebird')
|
const { pipeline, Transform } = require('stream')
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
const moment = require('moment')
|
const moment = require('moment')
|
||||||
|
|
||||||
const pageHelper = require('../../../helpers/page')
|
const pageHelper = require('../../../helpers/page')
|
||||||
@@ -130,7 +128,7 @@ module.exports = {
|
|||||||
WIKI.models.knex.column('id', 'path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt', 'editorKey').select().from('pages').where({
|
WIKI.models.knex.column('id', 'path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt', 'editorKey').select().from('pages').where({
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
const pageObject = await WIKI.models.pages.query().findById(page.id)
|
const pageObject = await WIKI.models.pages.query().findById(page.id)
|
||||||
@@ -153,7 +151,7 @@ module.exports = {
|
|||||||
|
|
||||||
await pipeline(
|
await pipeline(
|
||||||
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (asset, enc, cb) => {
|
transform: async (asset, enc, cb) => {
|
||||||
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ const path = require('path')
|
|||||||
const sgit = require('simple-git')
|
const sgit = require('simple-git')
|
||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
const klaw = require('klaw')
|
const klaw = require('klaw')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
|
||||||
@@ -441,7 +439,7 @@ module.exports = {
|
|||||||
return !_.includes(f, '.git')
|
return !_.includes(f, '.git')
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (file, enc, cb) => {
|
transform: async (file, enc, cb) => {
|
||||||
const relPath = file.path.substr(this.repoPath.length + 1)
|
const relPath = file.path.substr(this.repoPath.length + 1)
|
||||||
@@ -476,7 +474,7 @@ module.exports = {
|
|||||||
WIKI.models.knex.column('id', 'path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt', 'editorKey').select().from('pages').where({
|
WIKI.models.knex.column('id', 'path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt', 'editorKey').select().from('pages').where({
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
const pageObject = await WIKI.models.pages.query().findById(page.id)
|
const pageObject = await WIKI.models.pages.query().findById(page.id)
|
||||||
@@ -500,7 +498,7 @@ module.exports = {
|
|||||||
|
|
||||||
await pipeline(
|
await pipeline(
|
||||||
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (asset, enc, cb) => {
|
transform: async (asset, enc, cb) => {
|
||||||
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
const S3 = require('aws-sdk/clients/s3')
|
const S3 = require('aws-sdk/clients/s3')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const pageHelper = require('../../../helpers/page.js')
|
const pageHelper = require('../../../helpers/page.js')
|
||||||
|
|
||||||
@@ -22,7 +20,7 @@ const getFilePath = (page, pathKey) => {
|
|||||||
module.exports = class S3CompatibleStorage {
|
module.exports = class S3CompatibleStorage {
|
||||||
constructor(storageName) {
|
constructor(storageName) {
|
||||||
this.storageName = storageName
|
this.storageName = storageName
|
||||||
this.bucketName = ""
|
this.bucketName = ''
|
||||||
}
|
}
|
||||||
async activated() {
|
async activated() {
|
||||||
// not used
|
// not used
|
||||||
@@ -136,7 +134,7 @@ module.exports = class S3CompatibleStorage {
|
|||||||
WIKI.models.knex.column('path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt').select().from('pages').where({
|
WIKI.models.knex.column('path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt').select().from('pages').where({
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
const filePath = getFilePath(page, 'path')
|
const filePath = getFilePath(page, 'path')
|
||||||
@@ -152,7 +150,7 @@ module.exports = class S3CompatibleStorage {
|
|||||||
|
|
||||||
await pipeline(
|
await pipeline(
|
||||||
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (asset, enc, cb) => {
|
transform: async (asset, enc, cb) => {
|
||||||
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
const SSH2Promise = require('ssh2-promise')
|
const SSH2Promise = require('ssh2-promise')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const stream = require('stream')
|
const { pipeline, Transform } = require('stream')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const pipeline = Promise.promisify(stream.pipeline)
|
|
||||||
const pageHelper = require('../../../helpers/page.js')
|
const pageHelper = require('../../../helpers/page.js')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
@@ -118,7 +116,7 @@ module.exports = {
|
|||||||
WIKI.models.knex.column('path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt').select().from('pages').where({
|
WIKI.models.knex.column('path', 'localeCode', 'title', 'description', 'contentType', 'content', 'isPublished', 'updatedAt', 'createdAt').select().from('pages').where({
|
||||||
isPrivate: false
|
isPrivate: false
|
||||||
}).stream(),
|
}).stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (page, enc, cb) => {
|
transform: async (page, enc, cb) => {
|
||||||
const filePath = getFilePath(page, 'path')
|
const filePath = getFilePath(page, 'path')
|
||||||
@@ -135,7 +133,7 @@ module.exports = {
|
|||||||
|
|
||||||
await pipeline(
|
await pipeline(
|
||||||
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
WIKI.models.knex.column('filename', 'folderId', 'data').select().from('assets').join('assetData', 'assets.id', '=', 'assetData.id').stream(),
|
||||||
new stream.Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: async (asset, enc, cb) => {
|
transform: async (asset, enc, cb) => {
|
||||||
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
const filename = (asset.folderId && asset.folderId > 0) ? `${_.get(assetFolders, asset.folderId)}/${asset.filename}` : asset.filename
|
||||||
|
|||||||
+4
-3
@@ -5,13 +5,14 @@ const compression = require('compression')
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const favicon = require('serve-favicon')
|
const favicon = require('serve-favicon')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const Promise = require('bluebird')
|
|
||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const crypto = Promise.promisifyAll(require('crypto'))
|
const crypto = require('crypto')
|
||||||
const pem2jwk = require('pem-jwk').pem2jwk
|
const pem2jwk = require('pem-jwk').pem2jwk
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
|
|
||||||
|
const randomBytesAsync = require('util').promisify(crypto.randomBytes)
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
@@ -119,7 +120,7 @@ module.exports = () => {
|
|||||||
analyticsService: '',
|
analyticsService: '',
|
||||||
analyticsId: ''
|
analyticsId: ''
|
||||||
})
|
})
|
||||||
_.set(WIKI.config, 'sessionSecret', (await crypto.randomBytesAsync(32)).toString('hex'))
|
_.set(WIKI.config, 'sessionSecret', (await randomBytesAsync(32)).toString('hex'))
|
||||||
_.set(WIKI.config, 'telemetry', {
|
_.set(WIKI.config, 'telemetry', {
|
||||||
isEnabled: req.body.telemetry === true,
|
isEnabled: req.body.telemetry === true,
|
||||||
clientId: uuid()
|
clientId: uuid()
|
||||||
|
|||||||
Reference in New Issue
Block a user