Code Monkey home page Code Monkey logo

Comments (9)

oddstr13 avatar oddstr13 commented on May 17, 2024

Only happens over what the addon (or Jellyfin?) determines is a connection over the internet (WAN, External), and then only over HTTP.

CONNECTION_MODE = {
'Local': 0,
'Remote': 1,
'Manual': 2
}

def _login(self, username, password):
mode = self.connect_manager['server-mode']
server = self.connect_manager['server-address']
result = self.connect_manager['login'](server, username, password, False if mode == 1 and server.startswith('http://') else True)

def login(self, server, username, password=None, clear=True, options={}):
if not username:
raise AttributeError("username cannot be empty")
if not server:
raise AttributeError("server cannot be empty")
try:
request = {
'type': "POST",
'url': self.get_jellyfin_url(server, "Users/AuthenticateByName"),
'json': {
'username': username,
'password': hashlib.sha1(password or "").hexdigest(),
}
}
if clear:
request['json']['pw'] = password or ""
result = self._request_url(request, False)
except Exception as error: # Failed to login
LOG.error(error)
return False
else:
self._on_authenticated(result, options)
return result

As to how it decides mode == 'Remote', I have decided I would like to keep my sanity (for now at least).

from jellyfin-kodi.

mcarlton00 avatar mcarlton00 commented on May 17, 2024

The quick and dirty fix is to just change https://github.com/jellyfin/jellyfin-kodi/blob/master/resources/lib/jellyfin/core/connection_manager.py#L161 from

request = {
    'type': "POST",
    'url': self.get_jellyfin_url(server, "Users/AuthenticateByName"),
    'json': {
        'username': username,
        'password': hashlib.sha1(password or "").hexdigest(),
    }
}
if clear:
    request['json']['pw'] = password or ""

to

request = {
    'type': "POST",
    'url': self.get_jellyfin_url(server, "Users/AuthenticateByName"),
    'json': {
        'username': username,
        'Pw': password,
    }
}

This way it bypasses the whole WAN detection/mode/shenanigans and always sends a clear password.

I haven't seen any of my boxes fail to connect, so I'm not sure if it's actually broken for people or not. This will get them working again if so. I agree that we should track down all the other unneeded code around this and keep it cleaned up though.

from jellyfin-kodi.

EraYaN avatar EraYaN commented on May 17, 2024

Shouldn't it be Pw instead of password?

from jellyfin-kodi.

mcarlton00 avatar mcarlton00 commented on May 17, 2024

It should, good catch. Corrected. Too early in the morning for me to be having technical discussions

from jellyfin-kodi.

oddstr13 avatar oddstr13 commented on May 17, 2024

I'm not sure of how emby/jf handles auth, and if they would reject a plain password login over wan.
As such, I would suggest just removing the clear check and unindenting the set password line

from jellyfin-kodi.

mcarlton00 avatar mcarlton00 commented on May 17, 2024

If we go that route, might as well just change the payload instead of adding another parameter later.

'json': {
    'username': username,
    'password': hashlib.sha1(password or "").hexdigest(),
    'Pw': password,
}

That being said, my impression was that all support for pre-hashed passwords had been removed, WAN or otherwise. I could be wrong though

from jellyfin-kodi.

anthonylavado avatar anthonylavado commented on May 17, 2024

Well, what @mcarlton00 says is correct. All pre-hashed password support has been removed, regardless of connection method. If you send one, you get a friendly 405 MethodNotAllowed.

Thus, my vote here is for whatever gets it working again with a plain password.

from jellyfin-kodi.

oddstr13 avatar oddstr13 commented on May 17, 2024

So that's a 405 when the pre-hashed password is present? or just when the plaintext one is missing?

Edit: If I'm reading this right, then both fields are required?
https://github.com/jellyfin/jellyfin/blob/master/MediaBrowser.Api/UserService.cs#L98L117

from jellyfin-kodi.

anthonylavado avatar anthonylavado commented on May 17, 2024

In jellyfin/jellyfin#1244 we have the relevant changes

from jellyfin-kodi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.