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

Conversions to typescript and misc stuff #99

Merged
merged 29 commits into from
Jan 1, 2021

Conversation

hawken93
Copy link
Contributor

@hawken93 hawken93 commented Dec 21, 2020

  • move linting to root dir, lint js and ts with lint:code, and update workflow to use it ignore api/generated, not the whole api/ folder
  • commandHandler doesn't need to do that cast API import
  • Playbackmanager to ts
  • order package.json alphabetically and make yarn serve a thing
  • Stop requests happening when the server is unknown, also move url creation into the ajax function.
  • maincontroller to ts
  • fetchhelper to ts
  • helpers to ts
  • Try fixing system volume call, it called a function that seems to not exist now. Couldn't find it in the docs. Not sure if it was broken before. Fixed up some callbacks to populate window.volume to get this info
  • application ready message moved down to the call that activates CAF (Still doesn't wait for it to be ready before doing other stuff though)

Please test throughly! A lot changed and regressions are possible..

@hawken93 hawken93 changed the title Conversions to typescript and Conversions to typescript and misc stuff Dec 21, 2020
@YouKnowBlom
Copy link
Contributor

YouKnowBlom commented Dec 21, 2020

Try fixing system volume call, it called a function that seems to not exist now. Couldn't find it in the docs. Not sure if it was broken before. Fixed up some callbacks to populate window.volume to get this info

We shouldn't have to support this on the receiver anymore I believe

@hawken93
Copy link
Contributor Author

Lol it's failing the tests because there are no js files left :D

src/helpers.ts Outdated Show resolved Hide resolved
@hawken93
Copy link
Contributor Author

#80

@hawken93
Copy link
Contributor Author

have made yarn lint:ts possible and fixed lint

@hawken93 hawken93 force-pushed the back-to-master branch 4 times, most recently from 99a420a to acefa6b Compare December 27, 2020 12:09
@hawken93
Copy link
Contributor Author

Tested this watching a movie and it worked allright :)

Copy link
Member

@ferferga ferferga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of any's around

package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
.eslintrc.js Outdated Show resolved Hide resolved
@@ -1,12 +1,12 @@
export function getFetchPromise(request) {
var headers = request.headers || {};
export function getFetchPromise(request: any): Promise<any> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export function getFetchPromise(request: any): Promise<any> {
export function getFetchPromise(request: never): Promise<never> {

If it's 100% impossible to determine exactly what kind of objects we will get here, use never or unknown. As more things we have without strictly typing, more bugs can slip.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These return a fetch response. I see tutorials using templating for the response type, for the arguments I suspect there is something ready to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed half of it

src/components/fetchhelper.ts Outdated Show resolved Hide resolved
@@ -55,71 +62,77 @@ export class playbackManager {
);
}

async playFromOptions(options) {
async playFromOptions(options: any): Promise<boolean> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves a new interface as well

}

playFromOptionsInternal(options) {
playFromOptionsInternal(options: any): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}

playNextItem(options, stopPlayer) {
var nextItemInfo = getNextPlaybackItemInfo();
playNextItem(options: any = {}, stopPlayer = false): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

return true;
}

return false;
}

playPreviousItem(options) {
playPreviousItem(options: any = {}): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

async playItem(item, options, stopPlayer) {
async playItem(
item: BaseItemDto,
options: any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@ferferga ferferga force-pushed the back-to-master branch 2 times, most recently from 1e61ea2 to 3ee3591 Compare December 30, 2020 17:38
@hawken93
Copy link
Contributor Author

hawken93 commented Dec 31, 2020

I have decided that I will not be refactoring more any types if they require making new interfaces in this PR.
I have started looking at queue manager stuff, and this will require me to take a serious new look at all of the complex structures that are getting passed around.

I'm not against a followup PR to fix more of these linter issues, in fact this is what I would prefer to do.

Copy link
Member

@ferferga ferferga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented many times in chat, we can fix linting and add more typings in the future, otherwise this PR will be insane (it's already insane, but we don't want to make it more insane) :).

I checked your newly added typings and I would say the status of this PR is much better than what it was when I requested changes, so as long as it works and doesn't break the client completely, I would say it's good to go.

Ping me once all the client testing is done.

@hawken93
Copy link
Contributor Author

Okay, I believe at this point @ferferga is satisfied with the changes after his review, despite not dealing with everything. I will now stop any more updates to this PR to allow for testing :)

@hamburglar2160
Copy link

hamburglar2160 commented Dec 31, 2020

Regression: Admin Dashboard->Active Devices does not report playback and does not load the minibar/remote control at the bottom
Server/web: 10.6.2

@hawken93
Copy link
Contributor Author

hawken93 commented Jan 1, 2021

Okay.. I think I got that bug fixes, it was in helpers.ts: getSenderReportingData. After dropping the extend() call it was not a shallow copy anymore. The null & delete operations deleted that information for everyone I think.

I figured it would be easier to not take a copy and live with sending some extra fields.

@hamburglar2160
Copy link

I've tested this on a whole bunch of devices and am not finding any regressions. LGTM

@hawken93
Copy link
Contributor Author

hawken93 commented Jan 1, 2021

Asking for anyone that would like to look over the code once more or test it :)

At this point it would be really nice to get it merged

@ferferga ferferga merged commit 437a95e into jellyfin:master Jan 1, 2021
@hawken93 hawken93 deleted the back-to-master branch January 1, 2021 18:04
@ferferga ferferga mentioned this pull request Jan 1, 2021
10 tasks
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.

5 participants