Переглянути джерело

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

Lauri Ojansivu 5 роки тому
батько
коміт
e01f4dbf13

+ 4 - 4
fix-download-unicode/cfs_access-point.txt

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

+ 1 - 1
models/export.js

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

+ 1 - 1
models/wekanCreator.js

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

+ 2 - 2
packages/wekan-ldap/server/ldap.js

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

+ 3 - 3
packages/wekan-oidc/oidc_server.js

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

+ 1 - 1
rebuild-wekan.sh

@@ -111,7 +111,7 @@ do
 	        npm_call -g install node-gyp
 	        # Latest fibers for Meteor 1.8.x
 		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
 	        curl https://install.meteor.com | bash
 		sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor

+ 1 - 1
sandstorm.js

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

+ 16 - 11
snapcraft.yaml

@@ -1,5 +1,5 @@
 name: wekan
-version: 0
+version: '0'
 version-script: git describe --tags |  cut -c 2-
 summary: The open-source kanban
 description: |
@@ -12,6 +12,11 @@ description: |
 
 confinement: strict
 grade: stable
+base: core18
+
+environment:
+  npm_config_unsafe_perm: "true"
+  NODE_ENV: "production"
 
 architectures:
   - amd64
@@ -65,9 +70,9 @@ apps:
 
 parts:
     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
-        stage-packages: [libssl1.0.0]
+        stage-packages: [libssl1.1]
         filesets:
             mongo:
                 - usr
@@ -81,21 +86,16 @@ parts:
     wekan:
         source: .
         plugin: nodejs
-        node-engine: 12.14.1
-        node-packages:
-            - node-gyp
-            - node-pre-gyp
-            - fibers
         build-packages:
             - ca-certificates
             - apt-utils
             - build-essential
-            - python
-#            - python3
+#            - python
+            - python3
             - g++
             - capnproto
             - curl
-            - libcurl3
+            - libcurl4
             - execstack
             - nodejs
             - npm
@@ -106,6 +106,11 @@ parts:
             rm -rf ~/.meteor ~/.npm /usr/local/lib/node_modules
             # Create the OpenAPI specification
             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
             #cd .build/python
             #git clone --depth 1 -b master https://github.com/Kronuz/esprima-python