Https link Plugin (Hopefully simple)

dsouvik215

Member
May 25, 2018
896
0
16
Hopefully this is a very simple idea and easy to implement.

For every user i setup, part of the processes is linking their download folder to an accessable HTTPS folder on the server. This link is always their username ie:

# ln -s /home/USER1/rtorrent/downloads/ /var/www/USER1

I am trying to create a plugin that does the following:

- Checks authentication/user to make sure it knows what user is logged in.
- redirects the new plugin tab so that when the plugin is clicked it simply opens this link in the tab.

Problem is multi-users i havent quite figured out how to get JS to do the authentication if even possible.

I should add im currently using lighttpd with htdigest for user authentication.

I am fairly new at all this and my code is probably garbage but im posting here anyways in case someone can tidy it up/figure it out. Im not looking for any functionality besides actually just being able to see the links to the files.

This is what i have to far:
Code:
var frame = null;
user = "$user"; ## I KNOW THIS ISNT RIGHT##

plugin.addNewTabWithURL = function( tabName, tabURL )
{
frame = document.createElement("IFRAME");
frame.name = "new_url";

frame.src = tabURL;
frame.id = "new_url";
frame.style.width = "100%";
frame.style.height = "100%";
frame.style.border = "0";
this.attachPageToTabs(frame,tabName);
}

theTabs.onShow = function(id)
{
if(id=="new_url")
{
frame.src = "https://server1.gamestuff.ca/" + user;
}
}

plugin.addNewTabWithURL( "File Explorer");
 

das329717

Member
May 25, 2018
928
0
16
you realize you can do this all in the webserver config and even make it per use.


Which webserver do you use (it doesnt' require sym linking at all)
 

jith45

Member
May 25, 2018
960
0
16
sorry no i had no idea, i guess back to google i go. I have just been using sym links for as long as i can remember and giving users their specific link.

I am using lighttpd so if i can get it to somehow use that and roll it into a plugin that would be great.