Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re: 'alert-danger' #1

Open
kustomzone opened this issue Dec 15, 2018 · 7 comments
Open

re: 'alert-danger' #1

kustomzone opened this issue Dec 15, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@kustomzone
Copy link

Hey Jeff, been enjoying your solside app, but just came across a small bug...
In the older version, 'solid-auth-simple.js' throws "Not authorized to access [path-to-file]" alert.
In the current version, 'solid-ide-solidHandler.js' throws "undefined (undefined)" alert.
They do this with any file that contains the text "alert-danger" due to the following code..

if(body && body.value && body.value.match('alert-danger')
           && !thing.url.match('solid-auth-simple')
        ) { // throw error..
        }

I'm not sure why the body text 'alert-danger' is targeted in this code, but also 'solid-auth-simple' is no longer present (ie. self-excluded from the alert).

Cheers.

@jeff-zucker
Copy link
Owner

Thanks much. Yes, ugly code. The thing is, either I need to do a recursive ACL search to find out if user is authorized by the file (in the works but tricky to do) or I need to try to get the file. If you try to get a file you aren't authorized for, you get back an HTML page including the words "alert-danger" so that is what I used to trap the error. Previously, when I was storing the code for solid -ide on the POD, that could cause problems because the words "alert-danger" occur in the javascript, so I excluded that. No longer relevant since everything moved to Github. Thanks for the reminder I need to clean this up, much appreciated. Maybe I should change it to look for /danger Will Robinson/ :-).

@kustomzone
Copy link
Author

Ah, nice hack!

But tricky cos 'alert-danger' is in Warp's app.css and bootstrap.css and many other css files i suspect.
I'm still using solid-auth-simple so the error puzzled me for a couple of days while i messed around with permissions until i noticed it was a specific css file throwing an authorization alert, which made no sense.
Even an alert saying "swy, 'alert-danger' found in body text" might save a little confusion. ;O)

Also, in Spoggy4 the file is renamed "solid-tools.js" so self-exclusion could be done dynamically..

var parts = document.currentScript.src.split("/");
var result = parts[parts.length - 1]; // "test.js"
// ... && !thing.url.match(result)

@jeff-zucker
Copy link
Owner

Proof once again, that clever as it may be, a hack is still a hack. I'll figure out something better and will let @smag0 know for spoggy. BTW, I'm about to release a new solid-file-client - that, with help of @linonetwo, will have tests and ec6 and other improvements.

@kustomzone
Copy link
Author

kustomzone commented Dec 16, 2018

Yes, linonetwo's been busy!
Cool, ready to pull upstream! :)

ping Smag0: @scenaristeur

@scenaristeur
Copy link

@kustomzone & @jeff-zucker thxs for the mention, I'll take a look. What i did for solid-tools of Spoggy4 was a 'pseudo-ugly-clone' of the solid-ide.

@jeff-zucker
Copy link
Owner

Spoggy looks cool, I hope to have time to actually explore it soon. I think the only major interface change will be that readFile() will return the body of the file, not an object with the body in body.value - a pain but worth it for consistency in the long run.

@scenaristeur
Copy link

spoggy4 was a test with Polymer3 & Solid', but Polymer3 is not stable.
A more stable version on which i'm working on is Spoggy with Polymer2 https://spoggy.herokuapp.com ( wait 15sec & refresh to let the server awake)
Look at the Menu / Solid' connect
https://github.com/scenaristeur/heroku-spoggy
I must refactor all thé interface, any contribution / suggestions are welcome
https://github.com/scenaristeur/heroku-spoggy/projects/1

@jeff-zucker jeff-zucker added the bug Something isn't working label Jan 27, 2019
@kustomzone kustomzone changed the title bug: 'alert-danger' re: 'alert-danger' Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants