Can scripts such as jquery be placed in the files part of DF?


#1

Just a little confused by scripting. Within the Scripts Menu can we not simply refer to our custom Scripts within Files and include them by referring to the path to the files? GitHub and elsewhere say they must be SFTPed up to a directory like this

/opt/bitnami/apps/dreamfactory/htdocs/storage/scripting

To be clear https://github.com/dreamfactorysoftware/dsp-core/wiki/API-Access-via-Scripts states

try {
eval( include( ‘test-include.js’ ) );
print( 'Including “test-include” worked: ’ + includeAvailable() );
} catch ( _ex ) {
print( ‘Failed to include “test-include.js” file:’ + _ex.message );
}

But why not

try {
eval( include( ‘/files/scripts/test-include.js’ ) );

So I am just not sure why or if this was something that got deprecated in V2? Where should I put PHP scripts - same place I assume but where? Thanks in advance.

BTW (this is an edit to my earlier post) the scripting directory mentioned above is read only so when using an SFTP client to upload files, I do not have the permissions. Total Catch22 so far.


#2

Anyone…I can´t add scripts to the storage/scripting folder using SSH because I do not have the permissions and I am not sure if the above alternative works. In fact we tested it and it does not. What is the right way of doing this?


#3

Charlie, I’m checking on this to see what the correct process is. I had assumed it would be to place the scripts in the storage/scripting folder and use include, but that’s not working for me either. I’ll update you when I have more info.


#4

Drew you are a godsend.


#5

Check out the documentation here: http://wiki.dreamfactory.com/DreamFactory/Features/Scripting/V8Js#Including_Other_Scripts
You have to use require and exports.

Can you explain why you don’t have access to the scripting directory? All the iterations I’ve tried haven’t yielded this restriction.


#6

These were both done with FileZilla using an AWS paired key. I do not have permission to upload to the directory and I do not have permission to change the permissions


#7

Anyone out there that can help me…It seems that the Bitnami AWS of DF has the scripting file set to read only for the public which means I cannot upload to it. I have tried PuTTy SSH to chmod the folder but access was also denied. Surely this directory must be 777 to be usable. How do I change it ?