Jump to content
DetlefM

Media Server, API, Missing Header Entry

Recommended Posts

DetlefM

I try to write a javascript application to access the web api from Mediaserver (like Electron).

Unlike other programming languages javascript restricts the requests to cross origin web services.

Only if cross origin calls are allowed from the website they are done from the javascript engine..

The Webservice can allow this access by send a header entry like 'Access-Control-Allow-Origin', '*''.

Today I get around with a small proxy server who adds this header to every requests - which is fine in development stage but not really fine for deployment.

I  havn't really understand what kind of Access Control is possible but I think for a local server like the DVB MediaServer to allow every access is ok because it is also possible with every other programming language.

 

see also https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

 

I have attached my  mini python server and a html page for testing. Please use firefox or chrome. The steps are :

Install python3 if not already on your machine, edit pyproxy.py and dvbtest.html with the correct address of the media server (my media server is on 192.168.0.108) and start it with python pyproxy.py

Afterwards you can open the html file dvbtest.html with firefox or chrome - Edge didn't work. I think I must provide for Edge something to the request to make a cross origin call.

The html files a correct result from the pyproxy.py and no result from the original server.

test.zip

Edited by DetlefM
Additional information

Share this post


Link to post
Griga

We (Tjod and me) had a short internal discussion about this matter. Will be looked after. Sooner or later... the main shortage here is time.

Share this post


Link to post
DetlefM

Take time, during my development there might be other issues I will find.

I will create new topics/questions/requests as it pops up for me. And when finally I came to a solution which can be tested there is the time to look over all "feature requests".

Share this post


Link to post
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • DetlefM
      By DetlefM
      I noticed several things during my tests that make debugging api calls difficult.
      /api/epg.html
      The returned XML string is often (but not always) incorrect if the EPG entry is not found.
      <?xml version="1.0" encoding="utf-8" ?><!-- by DVBViewer Media Server --><epg Ver="1">
      The end tag is missing.
      Here it would be nice (besides the return of a valid XML string) to get an error code included. For example: wrong channelid, epgid not found
      When searching for pdc with a wrong pdc value (in my case 'NOPDC') this filter is completely ignored and the EPG list of the channel is returned. I think also here an error message would be more helpful.
      Many other api calls have no return value at all - e.g. timeredit. Here it would be helpful if the changed timer (or an error code in case of problems) would be returned.
    • t5b6_de
      By t5b6_de
      Hallo zusammen, 
       
      ich möchte für den DVBViewer und den Media Server plugins schreiben die  (im ersten Schritt Daten im TS-Datenstrom abgreifen, später dann auch manipulieren)
       
      Gibt es irgendwo ein Projektbeispiel für Visual Studio in c++ oder c?

      Ich konnte leider keines finden, oder war nicht in der Lage einen passenden Suchbegriff zu formulieren.
       
      Grüße
      Thomas
    • AnBad
      By AnBad
      Hallo,
      weiß jemand eine Möglichkeit wie man von FHEM aus EPG_Daten des Mediaservers aufrufen bzw. nach FHEM importieren kann? Also z.B. einmal am Tag für bestimmte Sender das Programm für z.B. die nächsten drei Tage.
       
      Ich weiß es gibt eine API-Schnittstelle im Mediaserver. Aber ich habe da keine Ahnung. Könnte man mit "http://[user]:[password]@[IP]:[port]/api/" Daten im Browser anzeigen lassen, die man dann mit Parsing abgreift? Wobei ich nicht einmal weiß, welchen User und Passwort ich in das Link eintragen müsste.
       
      Danke
      Michael
    • sir drake
      By sir drake
      Hallo Griga,
      ich möchte ein meinem Programm neben dem CHANNEL-NAME auch die Quelle( SAT/Internet...HLS Deutsch....)  einer Aufnahme anzeigen.
      In einem TIMER-RECORD habe kann ich hierfür den Node  <CHANNEL ID> zerlegen und benutzen.
      In einem RECORDING-RECORD habe ich nur den Node >CHANNEL>xxxx</CHANNEL>
      Das reicht leider für meine Zwecke nicht aus.

      <recording id="98" charset="255" start="20181021195500" duration="001000">
      <channel>Das Erste</channel>
      <channel ID>1234567890</channel ID>
      <file>
      d:\_aufnahmen\2018-10-21_19-59-23_das erste_tagesschau.ts
      </file>
      <title>Tagesschau</title>
      <image>2706243175_SM.jpg</image>
      </recording>
       
      Vielleicht kannst du diesen Node optional beim Aufruf hinzufügen:
       
      ....://localhost:8089/api/recordings.html?utf8=1&amp;images=1;channel_id=1
       
       
      vg & Dank 
      Sir Drake
    • sir drake
      By sir drake
      Hello Griga,
       
      maybe somthing for further versions.
       
      by using the Tasks-command ( api/tasks.html?action=.... ) 
      i did not know, when a started process is finished.
      (also not if start has happen successfully. no feedback given ) 

      should it be possible to implement this as a feedback
      once in the existing status2-request or in a sep. new tasks-status-request ? 

      in a very specific case i need to know if a process has ended 
      prior i fire the next command to dms.
       
      every suggestion is welcome
       
      brgds
      sir drake
       
×
×
  • Create New...