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') =>
|
||||
`/#/play/${theme}/${encodeURIComponent(url)}`
|
||||
|
||||
export const getFileExtension = fileName =>
|
||||
fileName.split('.').pop()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,21 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
import { getFileExtension } from '~/src/utils/utils.routing'
|
||||
|
||||
export default function ({params: {theme, 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 (
|
||||
<div>
|
||||
{theme} <br/>
|
||||
{type} <br/>
|
||||
{url}
|
||||
</div>)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue