GithubHelp home page GithubHelp logo

nodesolidserver / node-solid-server Goto Github PK

View Code? Open in Web Editor NEW
1.8K 1.8K 297.0 13.47 MB

Solid server on top of the file-system in NodeJS

Home Page: https://solidproject.org/for-developers/pod-server

License: Other

JavaScript 86.25% Makefile 0.73% HTML 2.03% Shell 0.52% Dockerfile 0.23% CSS 0.28% Python 0.88% Handlebars 9.08%
running-code

node-solid-server's People

Contributors

angelo-v avatar bourgeoa avatar csarven avatar dan-f avatar dmitrizagidulin avatar ewingson avatar greenkeeperio-bot avatar he8us avatar jaxoncreed avatar jeff-zucker avatar joachimvh avatar justinwb avatar kjetilk avatar linonetwo avatar m14t avatar martinmr avatar megoth avatar melvincarvalho avatar michielbdejong avatar nicola avatar renovate[bot] avatar rubensworks avatar rubenverborgh avatar snyk-bot avatar tallted avatar timbl avatar timea-solid avatar tomasklapka avatar vemonet avatar zg009 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-solid-server's Issues

Subscription machine crashes out in publishData whenever a PATCH succeeds

TypeError: undefined is not a function
at Object.exports.publishDelta (/devel/github.com/linkeddata/ldnode/subscription.js:147:5)
at /devel/github.com/linkeddata/ldnode/handlers/patch.js:123:34
at doPatch (/devel/github.com/linkeddata/ldnode/node_modules/rdflib/dist/rdflib.js:4340:9)
at $rdf.IndexedFormula.applyPatch (/devel/github.com/linkeddata/ldnode/node_modules/rdflib/dist/rdflib.js:4369:9)
at handler (/devel/github.com/linkeddata/ldnode/handlers/patch.js:108:22)
at Layer.handle as handle_request
at next (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/route.js:112:3)
at Layer.handle as handle_request
at /devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:277:22

Test folder is hard-coded

While it could be useful to hard code the test folder, it should not be hard-coded in this way:

/devel/github.com/linkeddata/node-ldp-httpd/test/

since we are assuming the developer is storing code in this way :(

Directory listing needs test

  • test amount of listinting to equal readdir
  • test File can't infer Container type
  • test all files have File and all folders have Container type

Rename project

A nine syllable name for this project is pretty painful. Whenever it comes up in conversation I find myself unable to remember the name, and unsure my listeners would understand/parse/recognize/remember it.

I suggest ldnode or ld-node would be a good name, along the lines of ldphp and ldpy, and not far from gold (which is ldgo re-ordered).

Coding style for module.exports

exports.something >> module.exports.something

Following this and many other sources, unless we are exporting a function as the only thing we export (instead of an object).

Hoisting

Mentioned here! #21

Exports declared at the end

In some part of the code (e.g. https://github.com/linkeddata/ldnode/blob/master/acl.js) I have seen that we declare some exports.something, and then we use them as exports.something. I think that makes the code a bit unreadable.

I think declaring an export in the following way is more of a standard in the js community.

function Handler () {..
// and at the end of the file
exports.handler = Handler

PS: I was going to make some pull reqs, but I think we should first agree on this!

PATCH crashes with TypeError: Arguments to path.join must be strings

This error I thought was fixed yesterday but has come back Monday morning 7/13.

ldnode:handlers PATCH -- text length: 342 +0ms
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at Object.uriToFilename (/devel/github.com/linkeddata/ldnode/fileStore.js:9:25)
at handler (/devel/github.com/linkeddata/ldnode/handlers/patch.js:18:25)
at Layer.handle as handle_request
at next (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/route.js:112:3)
at Layer.handle as handle_request
at /devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:277:22

dependency on coffee-script

timbl: > [email protected] postinstall /devel/github.com/linkeddata/ldnode/node_modules/webid

> cake build
sh: cake: command not found

This was trying to do an install from scratch of ldnode

Would it be possible to add the coffee-script dependency to the install?

URIs in link: headers should be relative where possible

  Link:     <http://www.w3.org/ns/ldp#Resource>; rel="type", </timbl/2015/08/02/poll/forms.ttl.changes>; rel="changes", <https://timbl.com/timbl/2015/08/02/poll/forms.ttl.acl>; rel="acl", <https://timbl.com/timbl/2015/08/02/poll/forms.ttl.meta>; rel="describedBy"

should be

  Link:     <http://www.w3.org/ns/ldp#Resource>; rel="type", <forms.ttl.changes>; rel="changes", <forms.ttl.acl>; rel="acl", <forms.ttl.meta>; rel="describedBy"

User: header is not sent

The Solid world requires the User: header to be sent back when a user is logged on with webid/TLS

Typical response headers from a GET authenitcated by webid currently:

status 200
status Text OK
connection keep-alive
content length 1367428
content type text/n3; charset=utf-8
etag W/"14dd84-P7TE3CNZwvMq1mvb6/zJ+w"
link http://www.w3.org/ns/ldp#Resource; rel='type', </TimBL/Automation/mother/state.n3.changes>; rel='changes'
ms author via SPARQL
updates via /TimBL/Automation/mother/state.n3.changes
x powered by Express
x response time 4.160ms

Missing CORS support.

ldnode does not currently support CORS headers. We need to have at least Access-Control-Allow-Origin support.

How to run secure-tests.js?

At the moment I am trying to run the tests but they all fail since they can't find the resources, hence the socket hang-up.

(I know they are under development! This is just to know how they work!)

Cleaning test folder

  • The test folder should be cleaned, meaning that all of its files that are not .js should be in a folder resources and testfiles should be a subdirectory of resources (it is important for testing to have a subdir!), possibly called testContainer. (done #80)
  • Splitting the test.js and restructure tests (done #85)
  • Also, there are files that are not needed.

baseUri is not needed

Following the LinkedData 2nd meeting. There is no need to set up the baseUri.

This should be set up by looking at the host in the request.

Remember: Always use the base that you find in the request

PATCH --> undefined is not a function at subscription.js:147:5

stderr exert:
Maybe the debug() function is undefined
This happens after a successful PATCH has been serviced, in the code to publish the change subscriptions. Whether or not --no-live is set in the command live

Tue, 14 Jul 2015 15:35:12 GMT ldnode:handlers PATCH -- applied OK (sync)
TypeError: undefined is not a function
    at Object.exports.publishDelta (/devel/github.com/linkeddata/ldnode/subscription.js:147:5)
    at /devel/github.com/linkeddata/ldnode/handlers/patch.js:123:34
    at doPatch (/devel/github.com/linkeddata/ldnode/node_modules/rdflib/dist/rdflib.js:4340:9)
    at $rdf.IndexedFormula.applyPatch (/devel/github.com/linkeddata/ldnode/node_modules/rdflib/dist/rdflib.js:4369:9)
    at handler (/devel/github.com/linkeddata/ldnode/handlers/patch.js:108:22)
    at Layer.handle [as handle_request] (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/layer.js:95:5)
    at next (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/layer.js:95:5)
    at /devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:277:22

Custom error pages, especially 401

I need to be able to set up a custom return HTML page for HTTP errors, especially error 401 "Unauthenticated". In practice this is an important part of the on-boarding process, to lead someone who does not have a webid to grab one.

Apache does this with the ErrorDocument directive a la
ErrorDocument 404 /Lame_excuses/not_found.html
ErrorDocument 401 /Subscription/how_to_subscribe.html

See https://httpd.apache.org/docs/2.2/custom-error.html

Implementing a route

The idea is to use routes instead of implementing it straight into the main toutes

// in server.js or whoever will implement it
app.use('/what_i_desire', routes);
// in our library
var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('*', function(req, res) {
});

router.patch('*', function(req, res) {
});

module.exports = router;

In this way, we can make something that any user can plug and play in their environment

This is only available in the latest express. Good idea to upgrade?

ACL file search skips every other level

debug trace, filtered:

ldnode:ACL Looking for policies in /Library/WebServer/Documents/TimBL/Automation/Library/Mashup/jquery.min.js.acl +0ms
ldnode:ACL Looking for policies in /Library/WebServer/Documents/TimBL/Automation/Library/Mashup/.acl +0ms
ldnode:ACL Looking for policies in /Library/WebServer/Documents/TimBL/Automation/.acl +0ms
ldnode:ACL Looking for policies in /Library/WebServer/Documents/.acl +0ms
ldnode:ACL Found policies in /Library/WebServer/Documents/.acl +0ms

It never found the one in /Library/WebServer/Documents/TimBL/Automation/Library/.acl

with
commit 30dc1b5
Author: nicola [email protected]
Date: Mon Jul 13 00:45:33 2015 +0200

It looks like dirname() being invoked twice ...

Code review: explaining options for session

I was wondering why every single option would be needed

 app.use(session({
    secret: 'node-ldp',
    saveUninitialized: false,
    resave: false
  }));

I consider the secret: 'node-ldp' by default a serious security issue

New repo for tests

The tests that we have in our folder are acceptance tests, in other words we are testing if the API works as expected. The same tests can be used for any other LDP implementation, e.g. gold.

So, my idea is that we could just take this tests out in a new package like ld-test or superld that tests a LDP. So that in this repo we can test more on unit testing.

This is just an idea, otherwise we could just leave things as they are, which are great!

Not working on warp

Gold (or databox.me) returns a listing of this kind:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<>
    a <http://www.w3.org/ns/ldp#BasicContainer>, <http://www.w3.org/ns/ldp#Container>, <http://www.w3.org/ns/posix/stat#Directory> ;
    <http://www.w3.org/ns/ldp#contains> <Applications/>, <Family/>, <Friends/>, <Preferences/>, <Private/>, <Public/>, <Work/>, <profile/> ;
    <http://www.w3.org/ns/posix/stat#mtime> "1435333390" ;
    <http://www.w3.org/ns/posix/stat#size> "4096" .

<Applications/>
    a <http://www.w3.org/ns/ldp#BasicContainer>, <http://www.w3.org/ns/ldp#Container>, <http://www.w3.org/ns/posix/stat#Directory> ;
    <http://www.w3.org/ns/posix/stat#mtime> "1435333433" ;
    <http://www.w3.org/ns/posix/stat#size> "4096" .

However ldnode returns this:

@prefix n0: </>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
@prefix st: <http://www.w3.org/ns/posix/stat#>.
@prefix keys: </keys/>.
@prefix res: </resources/>.

<#>
    ldp:contains
        </acl.js>,
        </formats.js>,
        </http.js>,
        n0:keys,
        </params.js>,
        </patch.js>,
        n0:resources;
    st:mtime
       1437300761000;
    st:size
       306.
   </acl.js> st:mtime 1437139220000; st:size 42866 .
   </formats.js> st:mtime 1437090751000; st:size 1982 .
   </http.js> st:mtime 1437302617000; st:size 6750 .
   keys: st:mtime 1436972622000; st:size 340 .
   </params.js> st:mtime 1437089197000; st:size 3349 .
   </patch.js> st:mtime 1437090751000; st:size 5410 .
   res: st:mtime 1437302621000; st:size 986 .

Since warp looks for POSIX(Directory) in here https://github.com/linkeddata/warp/blob/gh-pages/src/app/list/list.js#L188

  • Either we need to specify that attribute in ldnode
  • We have to change how warp does that

Is the Makefile still needed?

Since package.json contains the script starts and the script test, is the Makefile still needed?
I am a bit confused of the references to tabulator and /dev/WWW (which I assume they were probably originally used for quick & dirty testing)

Update

What I am seeing now is that in order to run the tests one has to run ldnode with some specific settings and just by doing make you start ldnode ready for test settings. However this should all be done by npm test. The user doesn't want to see or do too many things when running the tests

Caching command line

  • What is the purpose of this?
  • Is it implemented?
  • What is the current state?

(although other conversation have been raised, I open an issue just to keep track of this)

Options.js should not have static attributes

Assuming we want to start two ldnode running, editing the options' attribute will statically edit the options of each ldnode instance.

This problem does not arise in the current version of ldnode that has to be run from terminal, but it does in my fork where I am transforming ldnode into a library rather than a command line tool.

See my branch nicola/ldnode#routes for reference

Hoisting issues

I have seen in this file: https://github.com/linkeddata/ldnode/blob/master/handlers/get.js that the functions get, parseContainer, parseLinkedData, globHandler, containerHandler, fileHandler are declared as anonymous functions and assigned to a variable.

Since they are called before they assigned, this may lead to a TypeError or similar issues related to variable hoisting in javascript. http://jamesallardice.com/explaining-function-and-variable-hoisting-in-javascript/

So either we move up the variables, or we declare them, however I think declaring them is not a good idea either.

Instead of declaring them inside a function call (this means 1000 function calls 1000 declarations), we could instead just declare them outside and carry all the variables they need, I assume req, res being the only two. (This comment is valid for all the other files in /handlers that I have seen)

RDF ACL for node

Along with authentication, RDF ACL authorization is an important feature for this server. Then we will be able to run it facing the open net rather than as a protected proxy.

The goal would be to make the file structure used on the server be compatible with gold, so that one could run node-ldp-httpd or gold on the same files and have redundancy of project, and no 'project lock-in'.

Also of course made sure node-rdf-acl works with any other express systems.

Login bug involving the WebID module

Turns out there's a bug in the webid module:

TypeError: Cannot call method 'replace' of undefined
  at new VerificationAgent (/devel/github.com/linkeddata/ldnode/node_modules/webid/index.js:21:23)
  at loginHandler (/devel/github.com/linkeddata/ldnode/login.js:20:30)
  at Layer.handle [as handle_request] (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/layer.js:95:5)
  at trim_prefix (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:312:13)
  at /devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:280:7
  at param (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:349:14)
  at param (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:365:14)
  at Function.process_params (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:410:3)
  at next (/devel/github.com/linkeddata/ldnode/node_modules/express/lib/router/index.js:271:10)
  at /devel/github.com/linkeddata/ldnode/index.js:125:24```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.