Webshare account sharing through the token
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-12-16 02:07:51 +01:00
parent 1941c794ad
commit fe3f945450
2 changed files with 15 additions and 4 deletions

View File

@@ -97,8 +97,8 @@ sealed class CinemaHost : IHostedService
|| config.WebshareToken != _lastWebshareToken)
{
// Re-create the Webshare session as the credentials have changed
if (config.WebshareUser != null && config.WebsharePassword != null) {
_webshare = new Session(config.WebshareUser, config.WebsharePassword, config.WebshareToken);
if ((!string.IsNullOrEmpty(config.WebshareUser) && !string.IsNullOrEmpty(config.WebsharePassword)) || !string.IsNullOrEmpty(config.WebshareToken)) {
_webshare = new Session(config.WebshareUser ?? "", config.WebsharePassword ?? "", config.WebshareToken);
string? token = _webshare.GetTokenAsync(default).GetAwaiter().GetResult();
if (token != config.WebshareToken) {
config.WebshareToken = token;

View File

@@ -53,10 +53,13 @@
<input is="emby-input" type="text" id="webshareUser" label="Webshare user name" />
<div class="fieldDescription">Webshare account to allow watching in better quality.</div>
</div>
<div class="inputContainer">
<input is="emby-input" type="password" id="websharePassword" label="Webshare password" />
</div>
<div class="inputContainer">
<input is="emby-input" type="text" id="webshareToken" label="Webshare token" />
<div class="fieldDescription">Allows Webshare account sharing without giving username/password to others.</div>
</div>
</div>
<br />
<div>
@@ -119,11 +122,18 @@
}));
var websharePassword = document.querySelector('#websharePassword');
if (config.WebsharePassword && config.WebsharePassword.length != 0)
websharePassword.value = "";
websharePassword.value = config.WebsharePassword;
websharePassword.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
var webshareToken = document.querySelector('#webshareToken');
if (config.WebshareToken && config.WebshareToken.length != 0)
webshareToken.value = config.WebshareToken;
webshareToken.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
Dashboard.hideLoadingMsg();
});
@@ -145,6 +155,7 @@
config.WebshareUser = document.querySelector('#webshareUser').value;
config.WebsharePassword = document.querySelector('#websharePassword').value;
config.WebshareToken = document.querySelector('#webshareToken').value;
ApiClient.updatePluginConfiguration(CinemaPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});