rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: surikat on May 13, 2017, 10:07:59 PM

Title: Allowed Referer does not help in this case ..
Post by: surikat on May 13, 2017, 10:07:59 PM
There is a resource where hotlinking takes place with the help of the browser extension:
http://www.hamatata.com/lib (http://www.hamatata.com/lib)
An extension is installed, then video is launched on any site. Then click on the "H" extension button. And you can watch without problems on the site of Hamata.  :(
My site is hosted. Hfs on a PC shares video on site.
How to protect from hotlinking?  :o
Title: Re: Allowed Referer does not help in this case ..
Post by: bmartino1 on May 14, 2017, 06:27:17 PM
jquery / java scripting -
http://stackoverflow.com/questions/5429649/how-to-prevent-javascript-linking

To discourage hotlinking you could put annoying code in the script and have that execute if window.location doesn't match your own site:

while (window.location.hostname !== 'www.example.com')
  alert('Plz stop hotlinking');

etc...
Title: Re: Allowed Referer does not help in this case ..
Post by: surikat on May 14, 2017, 07:32:21 PM

Thank you so much! But the question arises in which script to add this:

Quote
while (window.location.hostname !== 'www.example.com')
  alert('Plz stop hotlinking');
  ?

Sorry for the dullness! :)
Title: Re: Allowed Referer does not help in this case ..
Post by: LeoNeeson on May 15, 2017, 12:00:03 AM
@surikat, wait a minute:

(http://i.imgur.com/gbx2A4L.png?3)                           (http://i.imgur.com/aPiThEr.gif?1)
"Calling to Doctor Mars (http://www.rejetto.com/forum/profile/?u=2913), calling to Doctor Mars (http://www.rejetto.com/forum/profile/?u=2913),
please report yourself at this ward...
A patient is awaiting your help...
" ;D


> Sorry for the joke, this forum needs a little fun!!.... :D
(I don't know the solution, but this must be very easy)

  
Title: Re: Allowed Referer does not help in this case ..
Post by: bmartino1 on May 17, 2017, 02:57:07 PM
there are many ways to impalament code in hfs...
First i would go to advace mode / expert mode

then got to html/template: "edit tempalte"

and add that code line in that template (under the header at the top)
Title: Re: Allowed Referer does not help in this case ..
Post by: bmartino1 on May 17, 2017, 03:06:06 PM
[+special:strings]
and following all the options you want to change, using the same syntax you see here.

[+special:strings]
option.paged=1
COMMENT this option causes your file list to be paged by default

option.newfolder=1
option.move=1
option.comment=1
option.rename=1
COMMENT with these you can disable some features of the template. Please note this is not about user permissions, this is global!

[]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
   <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   <title>{.!HFS.} %folder%</title>
   <link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
    <script type="text/javascript" src="/?mode=jquery"></script>
   <link rel="shortcut icon" href="/favicon.ico">
   <style class='trash-me'>
   .onlyscript, button[onclick] { display:none; }
   </style>
    <script>
    // this object will store some %symbols% in the javascript space, so that libs can read them
    HFS = { folder:'{.js encode|%folder%.}', number:%number%, paged:{.!option.paged.} };
    </script>
   <script type="text/javascript" src="/?mode=section&id=lib.js"></script>

###########################################
   
// place hear in header or
<script>
   while (window.location.hostname !== '(Public ip address of HFS/DNS name')
  alert('Plz stop hotlinking');
  </script>
########################################################

</head>
<body>

##############################################################

// place hear in body
<script>
   while (window.location.hostname !== 'www.example.com')
  alert('Plz stop hotlinking');
  </script>
###########################################################


<!--{.comment|--><h1 style='margin-bottom:100em'>WARNING: this template is only to be used with HFS 2.3 (and macros enabled)</h1> <!--.} -->
{.$box panel.}
{.$list.}
</body>
</html>
<!-- Build-time: %build-time% -->
====================================
##################################
etc.. hfs defatul tempalte (e3xced mesage llimit)[/list]
Title: Re: Allowed Referer does not help in this case ..
Post by: LeoNeeson on May 18, 2017, 02:30:01 AM
Correct me if I'm mistaken, but using JavaScript only prevents the hotlinking of all resources loaded and contained on a HTML page, and NOT if a file is accessed directly. That's why I think this needs to be done using Macros at "file access" level (in the server), and not using JavaScript (which depends on a client side setting, on the user's browser).
Title: Re: Allowed Referer does not help in this case ..
Post by: bmartino1 on May 19, 2017, 05:22:48 PM
you are correct leo:

as per the posted code from http://stackoverflow.com

quote "To discourage hotlinking you could put annoying code in the script and have that execute"

if some one has the direct file link, then the page loading the script will not work or alert them...
Title: Re: Allowed Referer does not help in this case ..
Post by: surikat on May 20, 2017, 09:01:14 PM
if some one has the direct file link, then the page loading the script will not work or alert them...

So, all users of the site will show annoying code?
Then this does not make sense?


Title: Re: Allowed Referer does not help in this case ..
Post by: bmartino1 on May 20, 2017, 09:04:30 PM
So, all users of the site will show annoying code?
Then this does not make sense?

 this is because the script is not being loaded at all, just the file itself... It makes perfect senses... I know not a way to stop it, just to discourage...
Title: Re: Allowed Referer does not help in this case ..
Post by: surikat on May 21, 2017, 12:45:19 AM
Probably you did not understand me correctly? My site has a different address and is on the hosting. HFS on the PC from which I share  the video to my site (CMS DLE).  Therefore it can not work.
Title: Re: Allowed Referer does not help in this case ..
Post by: LeoNeeson on May 24, 2017, 01:58:32 AM
Probably you did not understand me correctly?
Yes, you are right, I personally don't understand your configuration and what are you trying to achieve. It would be better if you share your HFS server IP, and your website URL, and give us a better explanation on how this it's supposed to work.
Title: Re: Allowed Referer does not help in this case ..
Post by: Mars on May 24, 2017, 11:24:19 AM
The web site would be located at an address XXXX, some pages sharing resources are located on an HFS server at a YYYY address (in this case, these are videos here),
 the problem is that the links to the hfs server Are certainly available in plain text and can be used in other web servers that do not suit him.

 This would be the same problem encountered on the web as those who use links to web images of sites not belonging to them instead of storing them on their own site, thus gaining room or free bass band at the expense of others websites

The ideal would be to allow hfs to recognize the address of its site as the only one to be allowed to access the video files.

The only solution that I imagine is that it is its site that makes access to videos as a proxy by putting them in a kind of temp memory before making them accessible to the user, thus allowing hfs to allow l Access to its files only from the web server address

Title: Re: Allowed Referer does not help in this case ..
Post by: rejetto on July 15, 2017, 07:19:54 PM
if you want to block SOME requests, and allow others, you have to be fully aware of what's the difference between the 2, and from the computer's point of view.
I don't think you already know this difference.
You have to record 2 requests, and study them.
Then you can create a command that forbids one and not the other.