Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic certificate generation for OneUI8 #65

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Epgenix
Copy link
Contributor

@Epgenix Epgenix commented Feb 2, 2025

@Georift Maybe i'm looking forward to simplify the process described here from @SayantanRC

As after the change to the new OneUI 8 the guidilines how apps are being installed also changed. There is now a "forced" account link between installing wgt packges on Samsung TV's. Although developer mode is active and there should be a flag to ignore certificates.

Ill create a pull request on that to resolve this.

Originally posted by @Epgenix in #51

So i've been working in this for a few hours now (mostly figuring some things out)
This pull request is not tested yet, as i'm facing some issues with the building process of the Docker Image.
Docker is complaining that the version requested for fastapi is not existing. (It is)

I guess there is some work to do to get it up running.
But the idea is here, and maybe someone is picking up on this. I will definitely update this PR with some changes in the coming days.

@RuslanMelnychenko
Copy link

RuslanMelnychenko commented Feb 5, 2025

I was trying to build the image and take a some issue
image

@RuslanMelnychenko
Copy link

RuslanMelnychenko commented Feb 6, 2025

For some reason, the image has python 3.6 and the library uses at least python

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 9, 2025

I encountered the same errors. I don't know how to fix that. Maybe someone else has a answer to that

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 9, 2025

I finally managed to get all things up and running. The last thing to do is to modify the Readme.md file accordingly to my changes. Maybe @Georift could help here.

The new instrucitons to install the package autmatically to any Samsung TV is:

docker run -p 4794:4794 <CONTAINER TAG NAME> --ip <DEVICE IP> --oneui8 --device-id <DEVICE ID> --email <SAME EMAIL AS LOGGED IN ON TV>

Example:

docker run -p 4794:4794 'test' --ip 192.168.1.137 --oneui8 --device-id GU43CU7179UXZG --email [email protected]

Wait until the server starts. The script will check every 5 seconds if the certificates are generated yet. Even if the script is not launched yet. So be patient, until there is a printed feedback from the script.

Open: localhost:4797/auth/start and follow the instructions

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 9, 2025

@Georift Nvm. I refactored the readme file. This pull request is ready for merging.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 12, 2025

@Georift Are you still maintaining this project? - Cause it looks like that you are very inactive. ^^

@sirlark
Copy link

sirlark commented Feb 14, 2025

Hi. I pulled this down and built the docker image from the Dockerfile. I'm running the docker image on a headless server, which presents some problems. I can point my laptop browser at headless:7494/auth/start and I get to the first problem. It returns a JSON blob, instead of showing instructions. If I then visit the redirect_url, and log in with my Samsung account, I'm redirected to localhost (which is my laptop, not my headless server). I hacked a bit in the code to change the redirect url to point to my headless server, but then my Samsung login failed. Next I tried doing this via links ssh'd into my headless server, but because the first response is JSON, I had to manually go to the redirect_url again, but again, the Samsung login fails.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 14, 2025

Actually this is the only thing where i can't actually help. As the generation script that i am using is from tizencertificates

I experienced the same issue with the JSON blob. This occures because docker is not able to open a browser on the host machiene. Therefore you have to manually visit the side. A possible solution to this would be to directly return the redirect_url to the output of the thermal. That would solve the JSON blob thing.

Unfortunately i have to say that i am not responsible for you problem with your headless server, as the original script is not build to be run with a headless server. But we can come together and try to fix it together.

@sirlark
Copy link

sirlark commented Feb 14, 2025

Ah, no worries. I'd hoped you had a quick answer. I'm going to try and hack at it a bit and see if I can figure it out.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 14, 2025

If you find a solution i would be happy if you concider implmenting it into my PR

@sirlark
Copy link

sirlark commented Feb 15, 2025

Hey 👋 I just wanted to let you know that it worked fine directly from my laptop. I'll keep at it from the headless server, but I'm not optimistic. The Samsung page itself doesn't like non-full-browsers, so I don't think I'll get a curl solution (or similar) to work

@Hippaduck
Copy link

Running into an issue that I don't see documented in the Readme.

Everything seems to work fine installing with the oneui8 steps but errors at the end with:

install failed[118, -12], reason: Check certificate error : :Invalid format of certificate in signature.:<-2>

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 15, 2025

@Hippaduck
Check if:

  • The account that you using to create the certificates and the account that you are logged in with your TV are matching
  • All preveous installations of Jellyfin are uninstalled

Are there any other log entrys that could be useful for debugging this issue?

@Hippaduck
Copy link

Jellyfin removed when the update happened and I can't find anywhere it may be installed still. The account is the same.
Here is the tail end of the logs

2025-02-15 11:33:30 Certificates not yet generated. Checking again in 5 seconds...
2025-02-15 11:33:34 INFO:     172.17.0.1:53248 - "POST /signin/callback HTTP/1.1" 200 OK
2025-02-15 11:33:35 Certificates generated and linked. CERTIFICATE_PASSWORD set.
2025-02-15 11:33:35 Attempting to sign package using provided certificate
2025-02-15 11:33:36 Author certficate: /certificates/author.p12
2025-02-15 11:33:36 Distributor1 certificate : /certificates/distributor.p12
2025-02-15 11:33:38 Package( /home/developer/Jellyfin.wgt ) is created successfully.
2025-02-15 11:33:39 Attempting to install jellyfin-tizen-builds Jellyfin.wgt from release: 2025-02-09-0632
2025-02-15 11:33:39 Transferring the package...
2025-02-15 11:33:41 Transferred the package: /home/developer/Jellyfin.wgt -> /home/owner/share/tmp/sdk_tools/tmp
2025-02-15 11:33:41 Installing the package...
2025-02-15 11:33:48 --------------------
2025-02-15 11:33:48 Platform log view
2025-02-15 11:33:48 --------------------
2025-02-15 11:33:48 install AprZAARz4r.Jellyfin
2025-02-15 11:33:48 package_path /home/owner/share/tmp/sdk_tools/tmp/Jellyfin.wgt
2025-02-15 11:33:48 app_id[AprZAARz4r.Jellyfin] install start
2025-02-15 11:33:48 app_id[AprZAARz4r.Jellyfin] installing[9]
2025-02-15 11:33:48 app_id[AprZAARz4r.Jellyfin] installing[19]
2025-02-15 11:33:48 app_id[AprZAARz4r.Jellyfin] install failed[118, -12], reason: Check certificate error : :Invalid format of certificate in signature.:<-2>
2025-02-15 11:33:48 spend time for wascmd is [6680]ms
2025-02-15 11:33:48 Failed to install Tizen application.
2025-02-15 11:33:48 Total time: 00:00:09.209

and the command I ran to kick it off

 docker run -p 4794:4794 tizen --ip _tvip_ --oneui8 --device-id _ID_ --email _email_

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 16, 2025

Hmm that is strange. I cannot identify any issues with the nstallation process here. Can you enter the container and check if the p12 certificates are in the right format?

Get into the Containers Shell
Use the bash command to open a functional shell, instead of using the docker one.

Check certs for expery date
The certificates are located under /certificates

@sirlark
Copy link

sirlark commented Feb 17, 2025

@Hippaduck @Epgenix When I got it to work, I used the email of my Samsung developer Account, not the email of the account signed into to the TV (which is my wife's).

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 17, 2025

Interesting, i never had an Samsung Developer Account, i straightup used my normal Samsung Account.

@sirlark
Copy link

sirlark commented Feb 17, 2025

Okay, I've done a bit of research, and I haven't found an obvious way to do this headless.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 18, 2025

Yeah i already tried to make it as headless as possible for everyone. But i think this is the limit. There is a need for user feedback in form of a browser window with callback.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 18, 2025

And actually what i'm now wondering when will this PR get merged. Is it possible that @Georift is not longer maintaining this?

@manueldev
Copy link

I tried to use it but I get this error:

git clone https://github.com/Epgenix/install-jellyfin-tizen.git
cd install-jellyfin-tizen
git submodule update --init
docker build .
 => ERROR [10/15] RUN ./install_python.sh                                                                          3.1s
------
 > [10/15] RUN ./install_python.sh:
2.334 /bin/sh: 1: ./install_python.sh: not found
------

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 19, 2025

is install_python.sh in the directory present?

@sreyemnayr
Copy link

Seems strange that it wouldn't error out on the earlier references to the same file. Sure it's not the hashbang /bin/bash from the top of the file that's not found?
See here: https://stackoverflow.com/questions/45405472/how-to-prevent-the-bin-bash-not-found-error-when-calling-a-script-from-doc

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 21, 2025

Hmm probably you right. Maybe the file format of install_python.sh is incorrect or something. I encountered a similar issue on the refactoring process of entrypoint.sh. I used dos2unix to remove the wierd hidden escape characters from windows and replace them with Unix ones.

@manueldev
Copy link

I put "#!/usr/bin/env bash"
and changed in sublimetext "View -> Line Endings" to "Unix".
Now "RUN ./install_python.sh" does run.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 21, 2025

If so then you can directly push your change into my branch if you want to. I invited you into my forked repo.

@manueldev
Copy link

The problem was my Git configuration on Windows. The first option was set. This changed the files to CRLF. The second option is ideal to keep everything in LF.

image

Now the problem is different. I get the invalid format error. I use the same email as Samsung developer and the one registered on the TV.

git clone https://github.com/Epgenix/install-jellyfin-tizen.git
cd install-jellyfin-tizen
git submodule update --init
docker build -t samsung .
docker run --rm -p 4794:4794 "samsung" --ip 192.168.1.84 --oneui8 --device-id [TV_ID] --email [mail]@gmail.com

app_id[AprZAARz4r.Jellyfin] install failed[118, -12], reason: Check certificate error : :Invalid format of certificate in signature.:<-2>
spend time for wascmd is [7005]ms
Failed to install Tizen application.
Total time: 00:00:11.223

@fightingsleep
Copy link

@Epgenix Dumb question, where do I get the device-id from? Is that the hostname of the TV? Might be worth putting in the readme

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 22, 2025

The problem was my Git configuration on Windows. The first option was set. This changed the files to CRLF. The second option is ideal to keep everything in LF.
image

Now the problem is different. I get the invalid format error. I use the same email as Samsung developer and the one registered on the TV.

git clone https://github.com/Epgenix/install-jellyfin-tizen.git
cd install-jellyfin-tizen
git submodule update --init
docker build -t samsung .
docker run --rm -p 4794:4794 "samsung" --ip 192.168.1.84 --oneui8 --device-id [TV_ID] --email [mail]@gmail.com
app_id[AprZAARz4r.Jellyfin] install failed[118, -12], reason: Check certificate error : :Invalid format of certificate in signature.:<-2>
spend time for wascmd is [7005]ms
Failed to install Tizen application.
Total time: 00:00:11.223

Hmm seems to be the same issue as @Hippaduck had. Could you please check this Error and this one out.

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 22, 2025

@Epgenix Dumb question, where do I get the device-id from? Is that the hostname of the TV? Might be worth putting in the readme

Ill rewrite th script oo that with --get-device-id the id is returned

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 22, 2025

The script improvements are ready. Let me know what you all think of this. Please feel free fo reach out if any errors occur.

@manueldev
Copy link

manueldev commented Feb 22, 2025

--get-device-id It gives me the model code of the TV. Is this correct?

Attempting to connect to Samsung TV at IP address 192.168.1.84
* Server is not running. Start it now on port 26099 *
* Server has started successfully *
connecting to 192.168.1.84:26101 ...
connected to 192.168.1.84:26101
Device ID: QN55QN90CAGXZS

I was able to complete the installation without any problems using the "Unique Device ID" value.

Installing the package...
--------------------
Platform log view
--------------------
install AprZAARz4r.Jellyfin
package_path /home/owner/share/tmp/sdk_tools/tmp/Jellyfin.wgt
app_id[AprZAARz4r.Jellyfin] install start
app_id[AprZAARz4r.Jellyfin] installing[9]
app_id[AprZAARz4r.Jellyfin] installing[19]
app_id[AprZAARz4r.Jellyfin] installing[29]
app_id[AprZAARz4r.Jellyfin] installing[39]
app_id[AprZAARz4r.Jellyfin] installing[48]
app_id[AprZAARz4r.Jellyfin] installing[58]
app_id[AprZAARz4r.Jellyfin] installing[68]
app_id[AprZAARz4r.Jellyfin] installing[78]
app_id[AprZAARz4r.Jellyfin] installing[87]
app_id[AprZAARz4r.Jellyfin] installing[97]
app_id[AprZAARz4r.Jellyfin] installing[100]
app_id[AprZAARz4r.Jellyfin] install completed
spend time for wascmd is [8190]ms
Installed the package: Id(AprZAARz4r.Jellyfin)
Tizen application is successfully installed.
Total time: 00:00:12.455

Possible fix for certificate error:
The error 'Check certificate error : :Invalid format of certificate in signature.:<-2>' suggests an issue with the certificate.
1. Verify your CERTIFICATE_PASSWORD is correct, if used.
2. Ensure the certificates in /certificates/author.p12 and /certificates/distributor.p12 are valid.
3. If using OneUI8 mode, make sure the certificate generation process completed successfully.
4. Try regenerating the certificates. If you are using the cert_server.py script, double check the device-id and email are correct

To avoid problems the correct value is: "Unique Device ID".
It is not "Model code", "Unique ID", or "Serial Number".

@Epgenix
Copy link
Contributor Author

Epgenix commented Feb 22, 2025

Also if any issues occur check this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants