Jump to content

EnableInUserMenu = true, plugin unresponsive for non admins


Recommended Posts

ginjaninja
Posted (edited)

I wish to make my plugin available to end users on the Webclient, so i have registered a page controller / page just for users with EnableInUserMenu = true, It works fine other than i have to press f5 after every action for non admins.

Claude tells me its becuase the Emby page wiring is hard coded to "sendmessagetoadminsessions" and not "sendmessagetousersessions"...but regardless does this make any sense and is there a way to make pages responsive to users.
https://github.com/ginjaninja1/ManageComingSoon/tree/main/UI
testing on 4.10.0.21
thanks

Edited by ginjaninja
Posted

Hi, after what actions?

ginjaninja
Posted (edited)
4 hours ago, Luke said:

Hi, after what actions?

Thanks @Luke, bear with me , becuase i am guessing what matters to investigating this.
I have a genericui buttonitem with a command handle "AddToList"
 

public override Task<IPluginUIView> RunCommand(string itemId, string commandId, string data)
{
    if (commandId == "AddToList")
    {
        HandleAddToList();
        return Task.FromResult<IPluginUIView>(this);
    }

Claude says the smoking gun in is PageControllerHostbase in that it is the something in the chain hardwired to "SendMessageToAdminSessions"

// Emby.Web.GenericUI.Control.PageHosts.PageControllerHostBase
protected void NotifyPageChangeDelayed(IUIView uiView)
{
	Task.Run(async delegate
	{
		await Task.Delay(500).ConfigureAwait(continueOnCapturedContext: false);
		UIViewInfo data = new UIViewInfo(uiView)
		{
			IsPageChangeInfo = true
		};
		await sessionManager.SendMessageToAdminSessions("UIPageInfoChanged", data, CancellationToken.None).ConfigureAwait(continueOnCapturedContext: false);
	});
}
private void CurrentUIViewOnUIViewInfoChanged(
    object sender,
    GenericEventArgs<IUIView> e)
{
    if (IsInitialized)
    {
        this.UIPageInfoChanged?.Invoke(this, e);

        UIViewInfo data =
            new UIViewInfo(e.Argument);

        sessionManager.SendMessageToAdminSessions(
            "UIPageInfoChanged",
            data,
            CancellationToken.None);
    }
}

 

Edited by ginjaninja
ginjaninja
Posted

Woohoo, Claude came good with a bit  of finesseing and gave me a solution.
https://github.com/ginjaninja1/ManageComingSoon/tree/TestuserpageswithoutcallingUIViewInfoChanged/UI/UserAddMovie
Claudes solution was to give me a page which did not rely on UIViewInfoChanged, and every button action has to immediately return a view.
Is this close to the intended approach? User facing plugins are supported but you have to be careful with what responsiveness you can expect and avoid RaiseUIViewInfoChanged?
 

 

Spoiler

What was deliberately removed

This page has no:

  • RaiseUIViewInfoChanged;
  • UIViewInfoChanged event handling;
  • task event subscriptions;
  • tracker state-change subscriptions;
  • poll timer;
  • refresh timer;
  • detached Task.Run search;
  • progress bar;
  • live task-status display.
  •  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...