Skip to content

Commit

Permalink
refactor: frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
xpadev-net committed Nov 22, 2023
1 parent 0ba920c commit 6c866f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/controller/convert/convert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ const Convert: FC = () => {
<p>duration: {movie.duration}</p>
{movie.type === "remote" && (
<>
<p>source: {movie.ref.url}</p>
<p>
source: https://nico.ms/{movie.ref.url} (
{movie.ref.format.type})
</p>
</>
)}
</div>
Expand All @@ -193,7 +196,7 @@ const Convert: FC = () => {
<p>format: {comment.format}</p>
{comment.type === "remote" && (
<>
<p>source: {comment.ref.url}</p>
<p>source: https://nico.ms/{comment.ref.url}</p>
</>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/controller/movie-picker/remote/remote-movie-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import Button from "@mui/material/Button";
import { useSetAtom } from "jotai";
import type { ChangeEvent, FC } from "react";
import { useState } from "react";
import { DMCMoviePicker } from "src/controller/movie-picker/remote/dmc";
import { DMSMoviePicker } from "src/controller/movie-picker/remote/dms";

import type { TWatchV3Metadata } from "@/@types/niconico";
import type { TMovieItemRemote, TRemoteMovieItemFormat } from "@/@types/queue";
import type { TRemoteServerType } from "@/@types/queue";
import { isLoadingAtom, messageAtom } from "@/controller/atoms";
import Styles from "@/controller/movie/movie.module.scss";
import { DMCMoviePicker } from "@/controller/movie-picker/remote/dmc";
import { DMSMoviePicker } from "@/controller/movie-picker/remote/dms";
import { typeGuard } from "@/typeGuard";
import { getNicoId, isNicovideoUrl } from "@/util/niconico";
import { uuid } from "@/util/uuid";
Expand Down
4 changes: 2 additions & 2 deletions src/util/niconico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import type {

const isNicovideoUrl = (url: string): boolean => {
return !!url.match(
/^(?:https?:\/\/)?(?:nico\.ms|(?:www\.)?nicovideo\.jp\/watch)\/((?:sm|nm|so)?[1-9][0-9]*)(?:.*)?$/,
/^(?:(?:https?:\/\/)?(?:nico\.ms|(?:www\.)?nicovideo\.jp\/watch)\/)?((?:sm|nm|so)?[1-9][0-9]*)(?:.*)?$/,
);
};
const getNicoId = (url: string): NicoId | undefined => {
const match = url.match(
/^(?:https?:\/\/)?(?:nico\.ms|(?:www\.)?nicovideo\.jp\/watch)\/((?:sm|nm|so)?[1-9][0-9]*)(?:.*)?$/,
/^(?:(?:https?:\/\/)?(?:nico\.ms|(?:www\.)?nicovideo\.jp\/watch)\/)?((?:sm|nm|so)?[1-9][0-9]*)(?:.*)?$/,
);
if (!match || !match[1]) return undefined;
return match[1] as NicoId;
Expand Down

0 comments on commit 6c866f2

Please sign in to comment.