proxy audio (#121)

This commit is contained in:
Ilya Y 2023-07-15 09:18:20 +03:00 committed by GitHub
parent cd83807204
commit d7184ddc9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 4 deletions

View File

@ -49,7 +49,7 @@
width: 200px;
height: 200px;
transition: all 0.2s ease-in-out;
background: var(--placeholder-color-semi) url('icons/create-music.svg') no-repeat 50% 50%;
background: var(--placeholder-color-semi) url('../../icons/create-music.svg') no-repeat 50% 50%;
.image {
object-fit: cover;

View File

@ -3,6 +3,7 @@ import { PlayerHeader } from './PlayerHeader'
import { PlayerPlaylist } from './PlayerPlaylist'
import styles from './AudioPlayer.module.scss'
import { MediaItem } from '../../../pages/types'
import { audioProxy } from '../../../utils/imageProxy'
export type Audio = {
pic?: string
@ -22,6 +23,7 @@ type Props = {
const prepareMedia = (media: Audio[]) =>
media.map((item, index) => ({
...item,
url: audioProxy(item.url),
index: index,
isCurrent: false,
isPlaying: false
@ -67,7 +69,6 @@ export const AudioPlayer = (props: Props) => {
isCurrent: index === 0
}))
)
return tracks()[0]
})()

View File

@ -1,4 +1,4 @@
import { createEffect, createSignal, For, Show } from 'solid-js'
import { createSignal, For, Show } from 'solid-js'
import { SharePopup, getShareUrl } from '../SharePopup'
import { getDescription } from '../../../utils/meta'
import { useLocalize } from '../../../context/localize'

View File

@ -230,18 +230,20 @@ export const EditView = (props: Props) => {
type="text"
placeholder={t('Artist...')}
class={styles.additionalInput}
value={mediaItems()[0]?.artist || t('Artist')}
value={mediaItems()[0]?.artist || ''}
onChange={(event) => handleBaseFieldsChange('artist', event.target.value)}
/>
<input
class={styles.additionalInput}
placeholder={t('Release date...')}
value={mediaItems()[0]?.date || ''}
onChange={(event) => handleBaseFieldsChange('date', event.target.value)}
/>
<input
type="text"
placeholder={t('Genre...')}
class={styles.additionalInput}
value={mediaItems()[0]?.genre || ''}
onChange={(event) => handleBaseFieldsChange('genre', event.target.value)}
/>
</div>

View File

@ -2,3 +2,7 @@ import { isDev } from './config'
export const imageProxy = (url: string) => {
return `${isDev ? 'https://new.discours.io' : ''}/api/image?url=${encodeURI(url)}`
}
export const audioProxy = (url: string) => {
return `${isDev ? 'https://new.discours.io' : ''}/api/audio?url=${encodeURI(url)}`
}