Socket
Socket
Sign inDemoInstall

alexandria-core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexandria-core - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

128

index.js

@@ -23,2 +23,3 @@ import axios from 'axios';

Core.IPFSGatewayURL = "http://gateway.ipfs.io/ipfs/";
Core.issoURL = "https://isso.alexandria.io/";

@@ -76,3 +77,7 @@ // Define URLS for things we don't control, these likely will change often

try {
files = oip['oip-041'].artifact.storage.files
let tmpFiles = oip['oip-041'].artifact.storage.files;
for (let i = 0; i < tmpFiles.length; i++) {
files.push(tmpFiles[i])
}
} catch(e) {}

@@ -90,4 +95,18 @@ return files;

Core.Artifact.getTimestamp = function(oip){
let timestamp = 0;
try {
timestamp = oip['oip-041'].artifact.timestamp
} catch(e) {}
return timestamp;
}
Core.Artifact.getPublisherName = function(oip){
return oip.publisherName ? oip.publisherName : "Flotoshi";
let pubName = "Flotoshi";
try {
pubName = oip.publisherName
} catch(e) {}
return pubName;
}

@@ -184,2 +203,28 @@

Core.Artifact.getMainFileDisPlay = function(oip, type){
let disPlay = false;
try {
disPlay = Core.Artifact.getMainPaidFile(oip, type).disPlay;
} catch (e) {}
if (!disPlay)
disPlay = false;
return disPlay
}
Core.Artifact.getMainFileDisBuy = function(oip, type){
let disBuy = 0;
try {
disBuy = Core.Artifact.getMainPaidFile(oip, type).disBuy;
} catch (e) {}
if (!disBuy)
disBuy = false;
return disBuy
}
Core.Artifact.getThumbnail = function(oip){

@@ -192,3 +237,3 @@ let thumbnail;

for (let i = 0; i < files.length; i++){
if (files[i].type === "Image" && files[i].sugPlay === 0 && files[i].fsize < Core.Artifact.maxThumbnailSize && !thumbnail){
if (files[i].type === "Image" && files[i].subtype === "cover" && !files[i].sugPlay && files[i].fsize < Core.Artifact.maxThumbnailSize && !thumbnail){
thumbnail = files[i];

@@ -331,2 +376,32 @@ }

Core.Comments = {};
Core.Comments.get = function(hash, callback){
Core.Network.getCommentsFromISSO("/browser/" + hash, function(results){
console.log(results);
callback(results);
})
}
Core.Comments.add = function(hash, comment, callback){
Core.Network.postCommentToISSO("/browser/" + hash, {text: comment}, function(results){
console.log(results)
callback(results);
})
}
Core.Comments.like = function(id, callback){
Core.Network.likeISSOComment(id, function(results){
console.log(results)
callback(results);
})
}
Core.Comments.dislike = function(id, callback){
Core.Network.dislikeISSOComment(id, function(results){
console.log(results)
callback(results);
})
}
Core.Data = {};

@@ -412,3 +487,3 @@

onData(Core.util.buildIPFSURL(hash));
//onData(Core.util.buildIPFSURL(hash));

@@ -440,3 +515,5 @@ try {

})
} catch (e){ }
} catch (e){
onData(Core.util.buildIPFSURL(hash));
}
}

@@ -470,2 +547,43 @@

Core.Network.getCommentsFromISSO = function(uri, callback){
axios.get(Core.issoURL + "?uri=" + encodeURIComponent(uri)).then(function(results){
callback(results);
}).catch(function (error) {
// If there is an error, it is likely because the artifact has no comments, just return an empty array.
callback([]);
});
}
Core.Network.postCommentToISSO = function(uri, comment, callback){
var instance = axios.create();
instance.post(Core.issoURL + "new?uri=" + encodeURIComponent(uri), comment, {headers: {"Content-Type": "application/json"}, transformRequest: [(data, headers) => {
delete headers.common.Authorization
return data }]
}).then(function(results){
callback(results);
}).catch(function (error) {
// If there is an error, it is likely because the artifact has no comments, just return an empty array.
callback({error: true});
});
}
Core.Network.likeISSOComment = function(id, callback){
axios.post(Core.issoURL + "id/" + id + "/like", {}).then(function(results){
callback(results);
}).catch(function (error) {
// If there is an error, it is likely because the artifact has no comments, just return an empty array.
callback({error: true});
});
}
Core.Network.dislikeISSOComment = function(id, callback){
axios.post(Core.issoURL + "id/" + id + "/dislike", {}).then(function(results){
callback(results);
}).catch(function (error) {
// If there is an error, it is likely because the artifact has no comments, just return an empty array.
callback({error: true});
});
}
Core.util = {};

@@ -472,0 +590,0 @@

2

package.json
{
"name": "alexandria-core",
"version": "1.0.3",
"version": "1.0.4",
"description": "The core module of Alexandria!",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc