Change Buffer to Buffer.alloc on Node v12. Try to fix Snap.

This commit is contained in:
Lauri Ojansivu 2020-01-11 13:08:29 +02:00
parent 5bece0dd1e
commit e01f4dbf13
8 changed files with 29 additions and 24 deletions

View file

@ -451,10 +451,10 @@ FS.HTTP.Handlers.Get = function (ref) {
if(userAgent.indexOf('msie') >= 0 || userAgent.indexOf('trident') >= 0 || userAgent.indexOf('chrome') >= 0) { if(userAgent.indexOf('msie') >= 0 || userAgent.indexOf('trident') >= 0 || userAgent.indexOf('chrome') >= 0) {
ref.filename = encodeURIComponent(ref.filename); ref.filename = encodeURIComponent(ref.filename);
} else if(userAgent.indexOf('firefox') >= 0) { } else if(userAgent.indexOf('firefox') >= 0) {
ref.filename = new Buffer(ref.filename).toString('binary'); ref.filename = new Buffer.alloc(ref.filename).toString('binary');
} else { } else {
/* safari*/ /* safari*/
ref.filename = new Buffer(ref.filename).toString('binary'); ref.filename = new Buffer.alloc(ref.filename).toString('binary');
} }
} catch (ex){ } catch (ex){
ref.filename = 'tempfix'; ref.filename = 'tempfix';

View file

@ -138,7 +138,7 @@ export class Exporter {
// [Old] for attachments we only export IDs and absolute url to original doc // [Old] for attachments we only export IDs and absolute url to original doc
// [New] Encode attachment to base64 // [New] Encode attachment to base64
const getBase64Data = function(doc, callback) { const getBase64Data = function(doc, callback) {
let buffer = new Buffer(0); let buffer = new Buffer.alloc(0);
// callback has the form function (err, res) {} // callback has the form function (err, res) {}
const tmpFile = path.join( const tmpFile = path.join(
os.tmpdir(), os.tmpdir(),

View file

@ -441,7 +441,7 @@ export class WekanCreator {
}); });
} else if (att.file) { } else if (att.file) {
file.attachData( file.attachData(
new Buffer(att.file, 'base64'), new Buffer.alloc(att.file, 'base64'),
{ {
type: att.type, type: att.type,
}, },

View file

@ -286,14 +286,14 @@ export default class LDAP {
if (attribute) { if (attribute) {
filter = new this.ldapjs.filters.EqualityFilter({ filter = new this.ldapjs.filters.EqualityFilter({
attribute, attribute,
value: new Buffer(id, 'hex'), value: new Buffer.alloc(id, 'hex'),
}); });
} else { } else {
const filters = []; const filters = [];
Unique_Identifier_Field.forEach((item) => { Unique_Identifier_Field.forEach((item) => {
filters.push(new this.ldapjs.filters.EqualityFilter({ filters.push(new this.ldapjs.filters.EqualityFilter({
attribute: item, attribute: item,
value : new Buffer(id, 'hex'), value : new Buffer.alloc(id, 'hex'),
})); }));
}); });

View file

@ -131,9 +131,9 @@ var getTokenContent = function (token) {
if (token) { if (token) {
try { try {
var parts = token.split('.'); var parts = token.split('.');
var header = JSON.parse(new Buffer(parts[0], 'base64').toString()); var header = JSON.parse(new Buffer.alloc(parts[0], 'base64').toString());
content = JSON.parse(new Buffer(parts[1], 'base64').toString()); content = JSON.parse(new Buffer.alloc(parts[1], 'base64').toString());
var signature = new Buffer(parts[2], 'base64'); var signature = new Buffer.alloc(parts[2], 'base64');
var signed = parts[0] + '.' + parts[1]; var signed = parts[0] + '.' + parts[1];
} catch (err) { } catch (err) {
this.content = { this.content = {

View file

@ -111,7 +111,7 @@ do
npm_call -g install node-gyp npm_call -g install node-gyp
# Latest fibers for Meteor 1.8.x # Latest fibers for Meteor 1.8.x
sudo mkdir -p /usr/local/lib/node_modules/fibers/.node-gyp sudo mkdir -p /usr/local/lib/node_modules/fibers/.node-gyp
npm_call -g install fibers@4.0.1 npm_call -g install fibers
# Install Meteor, if it's not yet installed # Install Meteor, if it's not yet installed
curl https://install.meteor.com | bash curl https://install.meteor.com | bash
sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor

View file

@ -55,7 +55,7 @@ if (isSandstorm && Meteor.isServer) {
const parsedDescriptor = Capnp.parse( const parsedDescriptor = Capnp.parse(
Powerbox.PowerboxDescriptor, Powerbox.PowerboxDescriptor,
new Buffer(descriptor, 'base64'), new Buffer.alloc(descriptor, 'base64'),
{ packed: true }, { packed: true },
); );

View file

@ -1,5 +1,5 @@
name: wekan name: wekan
version: 0 version: '0'
version-script: git describe --tags | cut -c 2- version-script: git describe --tags | cut -c 2-
summary: The open-source kanban summary: The open-source kanban
description: | description: |
@ -12,6 +12,11 @@ description: |
confinement: strict confinement: strict
grade: stable grade: stable
base: core18
environment:
npm_config_unsafe_perm: "true"
NODE_ENV: "production"
architectures: architectures:
- amd64 - amd64
@ -65,9 +70,9 @@ apps:
parts: parts:
mongodb: mongodb:
source: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.2.2.tgz source: https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/4.2/multiverse/binary-amd64/mongodb-org-server_4.2.2_amd64.deb
plugin: dump plugin: dump
stage-packages: [libssl1.0.0] stage-packages: [libssl1.1]
filesets: filesets:
mongo: mongo:
- usr - usr
@ -81,21 +86,16 @@ parts:
wekan: wekan:
source: . source: .
plugin: nodejs plugin: nodejs
node-engine: 12.14.1
node-packages:
- node-gyp
- node-pre-gyp
- fibers
build-packages: build-packages:
- ca-certificates - ca-certificates
- apt-utils - apt-utils
- build-essential - build-essential
- python # - python
# - python3 - python3
- g++ - g++
- capnproto - capnproto
- curl - curl
- libcurl3 - libcurl4
- execstack - execstack
- nodejs - nodejs
- npm - npm
@ -106,6 +106,11 @@ parts:
rm -rf ~/.meteor ~/.npm /usr/local/lib/node_modules rm -rf ~/.meteor ~/.npm /usr/local/lib/node_modules
# Create the OpenAPI specification # Create the OpenAPI specification
rm -rf .build rm -rf .build
npm -g install n
n 12.14.1
npm install -g node-gyp
npm install -g node-pre-gyp
npm install -g fibers
#mkdir -p .build/python #mkdir -p .build/python
#cd .build/python #cd .build/python
#git clone --depth 1 -b master https://github.com/Kronuz/esprima-python #git clone --depth 1 -b master https://github.com/Kronuz/esprima-python