1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #2044 from neilsb/schedules-direct-fix

Fix Schedules Direct Listings
This commit is contained in:
Claus Vium 2020-11-09 08:15:42 +01:00 committed by GitHub
commit 93d3dd822a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,40 +83,13 @@ export default function (page, providerId, options) {
loading.hide();
}
function sha256(str) {
if (!self.TextEncoder) {
return Promise.resolve('');
}
const buffer = new TextEncoder('utf-8').encode(str);
return crypto.subtle.digest('SHA-256', buffer).then(function (hash) {
return hex(hash);
});
}
function hex(buffer) {
const hexCodes = [];
const view = new DataView(buffer);
for (let i = 0; i < view.byteLength; i += 4) {
const value = view.getUint32(i);
const stringValue = value.toString(16);
const paddedValue = ('00000000' + stringValue).slice(-'00000000'.length);
hexCodes.push(paddedValue);
}
return hexCodes.join('');
}
function submitLoginForm() {
loading.show();
sha256(page.querySelector('.txtPass').value).then(function (passwordHash) {
const info = {
Type: 'SchedulesDirect',
Username: page.querySelector('.txtUser').value,
EnableAllTuners: true,
Password: passwordHash,
Pw: page.querySelector('.txtPass').value
Password: page.querySelector('.txtPass').value
};
const id = providerId;
@ -141,7 +114,6 @@ export default function (page, providerId, options) {
message: globalize.translate('ErrorSavingTvProvider')
});
});
});
}
function submitListingsForm() {