Skip to content

Commit

Permalink
Fix issue with NFL tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 17, 2024
1 parent 1e5d855 commit f27d68f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://i.imgur.com/FIGZdR3.png">
</p>

Current version: **3.3.2**
Current version: **3.3.3**

# About
This takes ESPN/ESPN+, FOX Sports, Paramount+, MSG+, NFL+, B1G+, NESN, Mountain West, FloSports, CBS Sports, or MLB.tv programming and transforms it into a "live TV" experience with virtual linear channels. It will discover what is on, and generate a schedule of channels that will give you M3U and XMLTV files that you can import into something like [Jellyfin](https://jellyfin.org) or [Channels](https://getchannels.com).
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eplustv",
"version": "3.3.2",
"version": "3.3.3",
"description": "",
"scripts": {
"start": "ts-node index.ts",
Expand Down
2 changes: 1 addition & 1 deletion services/launch-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const startChannelStream = async (channelId: string, appUrl: string) => {

checkingStream[channelId] = true;

let url;
let url: string;
let headers: IHeaders;

const playingNow = await db.entries.findOne<IEntry>({
Expand Down
11 changes: 6 additions & 5 deletions services/nfl-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class NflHandler {
return;
}

if (!this.expires_at || moment(this.expires_at).isBefore(moment().add(30, 'minutes'))) {
if (!this.expires_at || moment(this.expires_at * 1000).isBefore(moment())) {
await this.extendTokens();
}
};
Expand Down Expand Up @@ -386,7 +386,7 @@ class NflHandler {

public getEventData = async (id: string): Promise<[string, IHeaders]> => {
try {
await this.extendTokens();
await this.refreshTokens();

const event = await db.entries.findOne<IEntry>({id});

Expand Down Expand Up @@ -438,7 +438,7 @@ class NflHandler {

private checkNetworkAccess = (): boolean => {
try {
const {plans, networks}: INFLJwt = jwt_decode(this.access_token);
const {plans, networks}: INFLJwt = jwt_decode(this.tv_access_token);

if (plans) {
const hasPlus = (this.checkPlusAccess() || networks?.NFLN) && useLinear ? true : false;
Expand Down Expand Up @@ -571,7 +571,7 @@ class NflHandler {
deviceId: this.device_id,
deviceInfo: Buffer.from(JSON.stringify(TV_DEVICE_INFO), 'utf-8').toString('base64'),
networkType: 'wifi',
refreshToken: this.refresh_token,
refreshToken: this.tv_refresh_token,
uid: this.uid,
...(uidSignature && {
signatureTimestamp,
Expand Down Expand Up @@ -605,7 +605,6 @@ class NflHandler {
this.tv_access_token = data.accessToken;
this.tv_refresh_token = data.refreshToken;
this.tv_expires_at = data.expiresIn;
this.save();

if (data.additionalInfo) {
data.additionalInfo.forEach(ai => {
Expand All @@ -617,6 +616,8 @@ class NflHandler {
});
}

this.save();

this.checkRedZoneAccess();
this.checkNetworkAccess();
} catch (e) {
Expand Down

0 comments on commit f27d68f

Please sign in to comment.