Coder Social home page Coder Social logo

otto-aa / solid-filemanager Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 16.0 12.21 MB

A file manager for solid pods.

Home Page: https://otto-aa.github.io/solid-filemanager/

HTML 1.25% CSS 1.42% TypeScript 90.33% Shell 0.02% JavaScript 6.96%
filemanager solid solid-app

solid-filemanager's People

Contributors

dependabot[bot] avatar joni2back avatar otto-aa 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

solid-filemanager's Issues

Error when using "Create File"

When creating a new file via the "Create File" option, the app creates a file and opens it for editing. Creating works fine, yet the editor opens with weird content (instead of being empty).

Drag & Drop support

Drag & Drop would feel good for:

  • Uploading files/folders
  • Moving files/folders into other folders

zip/unzip with acl

Can you add to your app zip with acl and unzip with validity control for acl.

I took inspiration from your work to implement zip/unzip in solid-ide.
I improved the functions so as to zip with acl and unzip with validity control for acl

  • zip with acl is done with the following
  const itemList = [
    ...folderData.files.map(item => [item.url, ...Object.values(item.links)]).flat(),
    ...folderData.folders.map(item => item.url),
    ...Object.entries(folderData.links).map(([type, item]) => item),
	  ]

  • unzip with validity control, uses fc.rdf.query() to make the following controls :
    -- acl is a valid rdf turtle
    -- either webId or everybody has 'control'
    -- accessTo links to parent file or parentFolder
	// check for acl resource
      	if (!itemName.endsWith('.acl')) {
          await self.updateFile(path, itemName, blob, contentType) // path+'/'
      	} else {
      	// read .acl content as text and check acl content for Webid or public (authorization, Control, accessTo)
      	// groups are not checked for 'Control'
      	blob.text().then(async content => {
      	  this.aclErr = ''

      	  // check if webId has control (use of aclAgent() or aclControl())
      	  const webId = Object.fromEntries(new Map([[app.webId, '']]))
      	  self.aclControl(destination, relativePath, content, null, null , webId)
      	  .then( async res => {
      	    if(res === 'incorrect rdf') return self.acl = self.acl.concat([relativePath + ': ' + self.err])
      	    if (res === 'acl') return await self.updateFile(path, itemName, content, contentType).catch(err => self.err = err)
	    if (res === 'noAgent' || res === 'noControl') {
	      this.aclErr = 'no "Control" for webId or everybody'

	      // or check if everybody has control (use of aclAgent() or aclControl())
	      self.aclControl(destination, relativePath, content, null, { acl: 'accessTo' }, null)
	      .then( async res => {
	      if (res === 'acl') return await self.updateFile(path, itemName, content, contentType).catch(err => self.err = err)								
	      else { self.acl = self.acl.concat([relativePath + ' : ' + this.aclErr]) }
	      })
	    }
          })
          .catch(err => self.err = err)     

The controls uses an aclControl() function

this.aclControl = async (path, itemName, content, s, p ,o) => {
  try {
    // find acl block for an agent
    const aclControl = await fc.rdf.queryTurtle(path+itemName,content, s, { acl: 'mode'}, { acl : 'Control' }) //s, p, o)
    if(!aclControl.length) { return self.err = 'noControl' }

    await aclControl.map(async ({subject: item}) => {
    // check if agent has 'Control' (check if 'write' could be enough with atomic delete)
    const aclAgent = await fc.rdf.query(path+itemName, item, p, o) // { acl: 'mode'}, { acl : 'Control' })
    if(!aclAgent.length) { return self.err = 'noAgent' }
	
    // check if accessTo is correct
    obj = Object.fromEntries(new Map([[(path+itemName).split('.acl')[0], '']]))
    const aclAccessTo = await fc.rdf.query(path+itemName, item, { acl: 'accessTo' }, obj)
    if(!aclAccessTo.length) { self.acl = self.acl.concat([itemName + ' wrong accessTo resource']); return self.err = 'noAccessTo' }
    /* not used (not formally needed with NSS) : check for default and authorization
    // check for default for folder.acl
    if ((path+itemName).split('.acl')[0].endsWith('/')) {
    const aclDefault = await fc.rdf.query(path+itemName, item, { acl: 'default' }, obj)
    if(!aclDefault.length) { self.acl = self.acl.concat([itemName + ' folder should have acl:default'])} //; return self.err = 'noAuthorization' }
    }
			
    // check for authorization not a blocking error
    const aclAuthorization = await fc.rdf.query(path+itemName, item, null, { acl: 'Authorization' })
    if(!aclAuthorization.length) { self.acl = self.acl.concat([itemName + ' no acl:authorization'])} // ;       return self.err = 'noAuthorization' }
    */		
  })
  } catch( err) {
    self.err = err
    return 'incorrect rdf'
   }
   return 'acl' //self.updateFile(path, itemName, content, contentType).catch(err => self.err = err)
}

Not working in Firefox

I'm not sure if I used solid-filemanager with latest Firefox before but I just tried it and after clicking "Enter your pod" I get a popup "Error: the resource at https://thewebalyst.solid.community/ requires you to login" and no files are displayed. The same thing in Chrome works fine.

Looking in the Firefox console I see this:

Source map error: request failed with status 404
Resource URL: https://otto-aa.github.io/solid-filemanager/build/static/js/main.d5cd0f84.chunk.js
Source Map URL: main.d5cd0f84.chunk.js.map[Learn More]
Source map error: request failed with status 404
Resource URL: https://otto-aa.github.io/solid-filemanager/build/static/js/2.42dfee7f.chunk.js
Source Map URL: 2.42dfee7f.chunk.js.map[Learn More]
Failed to register/update a ServiceWorker for scope ‘https://otto-aa.github.io/solid-filemanager/build/’: Load failed with status 404 for script ‘https://otto-aa.github.io/solid-filemanager/build/service-worker.js’.
Request to access cookie or storage on “https://thewebalyst.solid.community/” was blocked because we are blocking all third-party storage access requests and content blocking is enabled. build
handleFetchError main.d5cd0f84.chunk.js:1:16326
url: https://thewebalyst.solid.community/ main.d5cd0f84.chunk.js:1:16443
status: 401 main.d5cd0f84.chunk.js:1:16480
errorMessage: <!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Log in</title>
  <link rel="stylesheet" href="/common/css/bootstrap.min.css">
  <link rel="stylesheet" href="/common/css/solid.css">
</head>
<body>
<div class="container">
  <div class="page-header">
    <div class="pull-right">
      <button id="register" type="button" class="btn btn-primary">Register</button>
      <button id="login"    type="button" class="btn btn-success">Log in</button>
    </div>
    <h1>Log in to access this resource</h1>
  </div>

  <div class="alert alert-danger">
    <p>
      The resource you are trying to access
      (<code>https://thewebalyst.solid.community/</code>)
      requires you to log in.
    </p>
  </div>

</div>
</div>
<script src="/common/js/solid-auth-client.bundle.js"></script>
<script src="/common/js/auth-buttons.js"></script>
</body>
</html>
main.d5cd0f84.chunk.js:1:17148
error: [object Response] main.d5cd0f84.chunk.js:1:17190

In Chrome there are no messages in the browser console.

I tried disabling privacy related plugins in Firefox but didn't see any change.

Move Folder not working

When trying to move a folder, the folder got deleted, but not copied to the new location.

Edits not saved

Using the edit function for a .txt file allows changing the text, but it couldn't be saved that way.

Error notification at startup

When starting the app it shows an error notification ("Error: Unknown error response from connector
"), likely because it already tries to fetch a folder despite being unable to do so.

Help about how your code works

Hello @Otto-AA , I'm a young software engineer student that is interested in see how your code works. I would like you to ask you some things.

Maybe you are going to obviate this message but for trying I lose nothing. Well we were assigned to develop a web decentralised chat using the solid platform. The thing is that there is not that much documentation out there for us to learn to use Solid. Searching in google I found your "Solid file manager" repository and for a couple of hours I've been trying to understand how you code works and figure out how to translate it to what we need but with a really bad result. We have little JavaScript idea so even how "export" and "import" modules in js work is just a pain.

Our application is just much much easier that yours. We actually, just want to create folders for the chat conversations and then inside the files representing the conversation itself, so we are interested in how you create,delete and update this folders or files. Would you like to suggest us some tips or any help? For us would be like magic!
I have to apologise myself for even writing this,and as I said you are so free to delete this and jump over, we totally understand it, it's not your problem.
Thanks in advance so much for taking you time reading this
Regards:
Javi

Enhance versioning/updating

Current Behavior

Currently the app is cached via a service worker, so the files only get loaded once and then remain the same. Loading a new version must be done manually (e.g. by a complete refresh). Also there's no way to find out the currently used version.

Expected behavior

The service worker should check for updates and display a notification if one is available. The user can then decided to update the app or stay with the old version.
There should be an info menu in which the user can view the version number and potentially update the app.

Issue logging in with Google Chrome

Hi,

This version works fine with Safari. But not working with google chrome. I am getting the following error message,

popup.html:24 TypeError: Cannot read property 'importKey' of undefined
at e.value (popup.html:24)
at Function.value (popup.html:24)
at Function.value (popup.html:24)
at popup.html:24
at Array.map ()
at Function.value (popup.html:24)
at popup.html:24
et @ popup.html:24
async function (async)
et @ popup.html:24
login @ popup.html:24
(anonymous) @ popup.html:24
async function (async)
(anonymous) @ popup.html:24
E @ popup.html:24

Copy folder

Adding an option to copy recursively copy a folder would be useful.

update to DPoP authentication. Legacy being deprecated.

Solid recently had an update from legacy auth to the use of DPoP auth.

We noticed that your app still is using the old auth.

We'd like to encourage you to switch to the new auth using the Demonstrating Proof of Posession technology.

Our motivation for the update was using the standard OIDC-way.

  • CSS is and will only use DPoP.
  • For a transition period NSS is able to use both legacy and DPoP.
  • SolidOS has been migrated and only uses DPoP.

Javascript libraries using the new authentication methods include :

Some simple examples of javascript app using the DPoP auth can be found here

The list of apps using the new DPoP authorization can be followed here dpop-status.

Just let us know if we can assist you on switching your app at https://gitter.im/solid/app-development or https://forum.solidproject.org

From solid team

It is not working with 5.0.0 version

Hi,

I tried to login with the pod that was created with the 5.0.0 stable version. When i tried to login with that pod, it gave me authentication error. Wont it work with the latest version?

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.