Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added websites/U/UFC Fight Pass/assets/fightpassufc.jpg
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this asset from PR

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions websites/U/UFC Fight Pass/dist/metadata.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove dist folder

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://schemas.premid.app/metadata/1.16",
"apiVersion": 1,
"author": {
"id": "922677780074881045",
"name": "_y3n"
},
"service": "UFC Fight Pass",

Check failure

Code scanning / PMD

Makes sure the service folder is correct Error

Expected service folder to be UFC Fight Pass, but got dist
"description": {
"en": "Watch UFC fights, live events, replays and highlights."
},
"url": [
"ufcfightpass.com",
"www.ufcfightpass.com"
],
"regExp": "^https?://([a-z0-9-]+\\.)*ufcfightpass\\.com/?",
"version": "1.0.0",
"logo": "https://i.imgur.com/hVg7eP2.jpg",

Check failure

Code scanning / PMD

Makes sure all images (logo and URLs) are exactly 512x512 pixels Error

Image URL dimensions must be exactly 512x512 pixels, got 558x445 for URL: https://i.imgur.com/hVg7eP2.jpg
"thumbnail": "https://i.imgur.com/hVg7eP2.jpg",
"color": "#e10600",
"category": "videos",
"tags": [
"ufc",
"mma",
"fight",
"sports",
"streaming",
"fightpass"
]
}
2 changes: 2 additions & 0 deletions websites/U/UFC Fight Pass/dist/presence.js

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

30 changes: 30 additions & 0 deletions websites/U/UFC Fight Pass/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://schemas.premid.app/metadata/1.16",
"apiVersion": 1,
"author": {
"id": "922677780074881045",
"name": "_y3n"
},
"service": "UFC Fight Pass",
"description": {
"en": "Watch UFC fights, live events, replays and highlights."
},
"url": [
"ufcfightpass.com",
"www.ufcfightpass.com"
],
"regExp": "^https?://([a-z0-9-]+\\.)*ufcfightpass\\.com/?",
"version": "1.0.0",
"logo": "https://i.imgur.com/hVg7eP2.jpg",

Check failure

Code scanning / PMD

Makes sure all images (logo and URLs) are exactly 512x512 pixels Error

Image URL dimensions must be exactly 512x512 pixels, got 558x445 for URL: https://i.imgur.com/hVg7eP2.jpg
"thumbnail": "https://i.imgur.com/hVg7eP2.jpg",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Image should be a landscape promotional image or screenshot. This image is too similar to logo

"color": "#e10600",
"category": "videos",
"tags": [
"ufc",
"mma",
"fight",
"sports",
"streaming",
"fightpass"
]
}

Check failure

Code scanning / ESLint

Require or disallow newline at the end of files Error

Newline required at end of file but not found.
71 changes: 71 additions & 0 deletions websites/U/UFC Fight Pass/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Assets } from "premid"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

const presence = new Presence({
clientId: "1492178685946499122",

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
})

const IMAGE_KEY = "fightpassufc"

Check failure

Code scanning / ESLint

Disallow unused variables Error

'IMAGE_KEY' is assigned a value but never used. Allowed unused vars must match /^_/u.

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This variable appears to be unused

const START_KEY = "ufc_start_time"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
const VIDEO_KEY = "ufc_video_id"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

function getMode(video: HTMLVideoElement, title: string) {
if (video.duration === Infinity || title.includes("live")) return "LIVE"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

Check failure

Code scanning / ESLint

Newline after if Error

Expect newline after if

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
if (title.includes("highlight")) return "HIGHLIGHTS"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

Check failure

Code scanning / ESLint

Newline after if Error

Expect newline after if

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
return "REPLAY"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
}

presence.on("UpdateData", async () => {

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
const now = Math.floor(Date.now() / 1000)
const video = document.querySelector("video") as HTMLVideoElement | null

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use generics for querySelector

const title = document.title.trim()

const presenceData: PresenceData = {
largeImageKey: "https://i.imgur.com/hVg7eP2.jpg",

Check failure

Code scanning / PMD

Makes sure all images (logo and URLs) are exactly 512x512 pixels Error

Image URL dimensions must be exactly 512x512 pixels, got 558x445 for URL: https://i.imgur.com/hVg7eP2.jpg

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
smallImageKey: Assets.Play,
}

// 🏠 HOME
if (!video) {
sessionStorage.removeItem(START_KEY)
sessionStorage.removeItem(VIDEO_KEY)

presenceData.details = "Homepage"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
presenceData.state = "Browsing fights"

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

presence.setActivity(presenceData)
return
}

const videoId = video.currentSrc || location.href
const savedVideoId = sessionStorage.getItem(VIDEO_KEY)

let startTimestamp = Number(sessionStorage.getItem(START_KEY))

if (
savedVideoId !== videoId ||

Check failure

Code scanning / ESLint

Enforce consistent linebreak style for operators Error

'||' should be placed at the beginning of the line.
!Number.isFinite(startTimestamp) ||

Check failure

Code scanning / ESLint

Enforce consistent linebreak style for operators Error

'||' should be placed at the beginning of the line.
startTimestamp <= 0
) {
startTimestamp = now
sessionStorage.setItem(START_KEY, String(startTimestamp))
sessionStorage.setItem(VIDEO_KEY, videoId)
}

const mode = getMode(video, title.toLowerCase())
const isPaused = video.paused

presenceData.details = isPaused ? `Paused (${mode})` : `Watching (${mode})`
presenceData.state = title
presenceData.smallImageKey = isPaused ? Assets.Pause : Assets.Play

// ⏱ TIMER
presenceData.startTimestamp = startTimestamp

// 🔥 PROGRESS BAR (REPLAY ONLY)
if (mode === "REPLAY" && isFinite(video.duration)) {

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

Check failure

Code scanning / ESLint

Prefer `Number` static properties over global ones. Error

Prefer Number.isFinite over isFinite.
presenceData.endTimestamp =

Check failure

Code scanning / ESLint

Enforce consistent linebreak style for operators Error

'=' should be placed at the beginning of the line.
startTimestamp + Math.floor(video.duration - video.currentTime)
}

presence.setActivity(presenceData)
})

Check failure

Code scanning / ESLint

Require or disallow newline at the end of files Error

Newline required at end of file but not found.
6 changes: 6 additions & 0 deletions websites/U/UFC Fight Pass/tsconfig.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this file from PR

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/"
}
}
Loading