mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Player: extract file extension
This commit is contained in:
parent
14f9c5be4c
commit
251fa153f0
2 changed files with 13 additions and 0 deletions
|
|
@ -22,3 +22,6 @@ export const useHashLocation = () => {
|
||||||
|
|
||||||
export const buildPlayLinkHref = (url, theme = 'default') =>
|
export const buildPlayLinkHref = (url, theme = 'default') =>
|
||||||
`/#/play/${theme}/${encodeURIComponent(url)}`
|
`/#/play/${theme}/${encodeURIComponent(url)}`
|
||||||
|
|
||||||
|
export const getFileExtension = fileName =>
|
||||||
|
fileName.split('.').pop()
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,21 @@
|
||||||
import { h } from 'preact'
|
import { h } from 'preact'
|
||||||
|
|
||||||
|
import { getFileExtension } from '~/src/utils/utils.routing'
|
||||||
|
|
||||||
export default function ({params: {theme, encodedUrl}}) {
|
export default function ({params: {theme, encodedUrl}}) {
|
||||||
const url = decodeURIComponent(encodedUrl)
|
const url = decodeURIComponent(encodedUrl)
|
||||||
|
const type = getFileExtension(url)
|
||||||
|
|
||||||
|
const fetchGameFile = fetch(url)
|
||||||
|
.then(response => (console.log(response), response))
|
||||||
|
.then(response => response.blob())
|
||||||
|
.then(console.log)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{theme} <br/>
|
{theme} <br/>
|
||||||
|
{type} <br/>
|
||||||
{url}
|
{url}
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue