mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Increase silly text chance and replace backend url with env var
This commit is contained in:
parent
2c5c61cb70
commit
f25e675f7f
4 changed files with 11 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
// 10% chance of getting a joke title
|
// 35% chance of getting a joke title (Cooper done changed this code!)
|
||||||
const shouldGiveJokeTitle = () => Math.floor(Math.random() * 10) === 0;
|
const shouldGiveJokeTitle = () => Math.random() < 0.35;
|
||||||
|
|
||||||
export function useRandomTranslation() {
|
export function useRandomTranslation() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { useNavigate } from "react-router-dom"; // Import Link from react-router
|
||||||
import { ThiccContainer } from "@/components/layout/ThinContainer";
|
import { ThiccContainer } from "@/components/layout/ThinContainer";
|
||||||
import { Divider } from "@/components/utils/Divider";
|
import { Divider } from "@/components/utils/Divider";
|
||||||
import { Heading1, Paragraph } from "@/components/utils/Text";
|
import { Heading1, Paragraph } from "@/components/utils/Text";
|
||||||
|
import { BACKEND_URL } from "@/setup/constants";
|
||||||
|
|
||||||
import { SubPageLayout } from "./layouts/SubPageLayout";
|
import { SubPageLayout } from "./layouts/SubPageLayout";
|
||||||
import { PageTitle } from "./parts/util/PageTitle";
|
import { PageTitle } from "./parts/util/PageTitle";
|
||||||
|
@ -84,7 +85,7 @@ function ConfigValue(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getRecentPlayedItems() {
|
async function getRecentPlayedItems() {
|
||||||
const response = await fetch("https://backend.sudo-flix.lol/metrics");
|
const response = await fetch(BACKEND_URL);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
|
|
||||||
const regex =
|
const regex =
|
||||||
|
@ -118,7 +119,7 @@ async function getRecentPlayedItems() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTotalViews() {
|
async function getTotalViews() {
|
||||||
const response = await fetch("https://backend.sudo-flix.lol/metrics");
|
const response = await fetch(BACKEND_URL);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
|
|
||||||
// Add up all mw_media_watch_count entries
|
// Add up all mw_media_watch_count entries
|
||||||
|
@ -138,7 +139,7 @@ async function getTotalViews() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProcessStartTime(): Promise<string> {
|
function getProcessStartTime(): Promise<string> {
|
||||||
return fetch("https://backend.sudo-flix.lol/metrics")
|
return fetch(BACKEND_URL)
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((text) => {
|
.then((text) => {
|
||||||
const regex = /process_start_time_seconds (\d+)/;
|
const regex = /process_start_time_seconds (\d+)/;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useNavigate } from "react-router-dom";
|
||||||
import { ThiccContainer } from "@/components/layout/ThinContainer";
|
import { ThiccContainer } from "@/components/layout/ThinContainer";
|
||||||
import { Divider } from "@/components/utils/Divider";
|
import { Divider } from "@/components/utils/Divider";
|
||||||
import { Heading1, Paragraph } from "@/components/utils/Text";
|
import { Heading1, Paragraph } from "@/components/utils/Text";
|
||||||
|
import { BACKEND_URL } from "@/setup/constants";
|
||||||
|
|
||||||
import { SubPageLayout } from "./layouts/SubPageLayout";
|
import { SubPageLayout } from "./layouts/SubPageLayout";
|
||||||
import { PageTitle } from "./parts/util/PageTitle";
|
import { PageTitle } from "./parts/util/PageTitle";
|
||||||
|
@ -24,7 +25,7 @@ function ConfigValue(props: { name: string; children?: ReactNode }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTopSources() {
|
async function getTopSources() {
|
||||||
const response = await fetch("https://backend.sudo-flix.lol/metrics");
|
const response = await fetch(BACKEND_URL);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
|
|
||||||
const regex =
|
const regex =
|
||||||
|
|
|
@ -3,9 +3,10 @@ import { ReactNode, useEffect, useState } from "react";
|
||||||
import { Divider } from "@/components/utils/Divider";
|
import { Divider } from "@/components/utils/Divider";
|
||||||
import { Heading2 } from "@/components/utils/Text";
|
import { Heading2 } from "@/components/utils/Text";
|
||||||
import { conf } from "@/setup/config";
|
import { conf } from "@/setup/config";
|
||||||
|
import { BACKEND_URL } from "@/setup/constants";
|
||||||
|
|
||||||
async function getAccountNumber() {
|
async function getAccountNumber() {
|
||||||
const response = await fetch("https://backend.sudo-flix.lol/metrics");
|
const response = await fetch(BACKEND_URL);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
|
|
||||||
// Adjusted regex to match any hostname
|
// Adjusted regex to match any hostname
|
||||||
|
@ -26,7 +27,7 @@ async function getAccountNumber() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAllAccounts() {
|
async function getAllAccounts() {
|
||||||
const response = await fetch("https://backend.sudo-flix.lol/metrics");
|
const response = await fetch(BACKEND_URL);
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
|
|
||||||
const regex = /mw_user_count{namespace="movie-web"} (\d+)/;
|
const regex = /mw_user_count{namespace="movie-web"} (\d+)/;
|
||||||
|
|
Loading…
Reference in a new issue