Skip to content

Commit 13b9b25

Browse files
authored
Merge pull request #440 from ShaneIsrael/develop
Develop
2 parents bc79fe6 + 651f24e commit 13b9b25

30 files changed

Lines changed: 1209 additions & 346 deletions

.env.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export SECRET_KEY=dev-test-key
77
export DATA_DIRECTORY=$(pwd)/dev_root/dev_data/
88
export VIDEO_DIRECTORY=$(pwd)/dev_root/dev_videos/
99
export PROCESSED_DIRECTORY=$(pwd)/dev_root/dev_processed/
10+
export STEAMGRIDDB_API_KEY=""
1011
export ADMIN_PASSWORD=admin
1112
export ADMIN_USERNAME=admin

app/client/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fireshare",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"private": true,
55
"dependencies": {
66
"@emotion/react": "^11.9.0",
@@ -48,4 +48,4 @@
4848
"last 1 safari version"
4949
]
5050
}
51-
}
51+
}

app/client/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function App() {
7979
path="/games"
8080
element={
8181
<AuthWrapper>
82-
<Navbar20 page="/games" collapsed={!drawerOpen} searchable>
82+
<Navbar20 page="/games" collapsed={!drawerOpen} searchable searchPlaceholder="Search games...">
8383
<Games />
8484
</Navbar20>
8585
</AuthWrapper>

app/client/src/common/utils.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const getVideoUrl = (videoId, quality, extension) => {
116116
const URL = getUrl()
117117
const SERVED_BY = getServedBy()
118118

119-
if (quality === '720p' || quality === '1080p') {
119+
if (quality === '480p' || quality === '720p' || quality === '1080p') {
120120
if (SERVED_BY === 'nginx') {
121121
return `${URL}/_content/derived/${videoId}/${videoId}-${quality}.mp4`
122122
}
@@ -141,20 +141,27 @@ export const getVideoUrl = (videoId, quality, extension) => {
141141
*/
142142
export const getVideoSources = (videoId, videoInfo, extension) => {
143143
const sources = []
144-
144+
145+
const has480p = videoInfo?.has_480p
145146
const has720p = videoInfo?.has_720p
146147
const has1080p = videoInfo?.has_1080p
147-
148-
// Add 720p
148+
149+
if (has480p) {
150+
sources.push({
151+
src: getVideoUrl(videoId, '480p', extension),
152+
type: 'video/mp4',
153+
label: '480p',
154+
})
155+
}
156+
149157
if (has720p) {
150158
sources.push({
151159
src: getVideoUrl(videoId, '720p', extension),
152160
type: 'video/mp4',
153161
label: '720p',
154162
})
155163
}
156-
157-
// Add 1080p
164+
158165
if (has1080p) {
159166
sources.push({
160167
src: getVideoUrl(videoId, '1080p', extension),
@@ -163,12 +170,11 @@ export const getVideoSources = (videoId, videoInfo, extension) => {
163170
})
164171
}
165172

166-
// Add original quality - always selected by default
167173
sources.push({
168174
src: getVideoUrl(videoId, 'original', extension),
169175
type: 'video/mp4',
170176
label: 'Original',
171-
selected: true, // Always default to original quality
177+
selected: true,
172178
})
173179

174180
return sources

app/client/src/components/admin/UploadCard.js

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ const Input = styled('input')({
1111

1212
const numberFormat = new Intl.NumberFormat('en-US')
1313

14-
const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fetchVideos, cardWidth, handleAlert, reserveDateSpace = false }) => {
15-
const cardHeight = cardWidth / 1.77 + 32
14+
const UploadCard = ({ authenticated, handleAlert, mini}) => {
1615
const [selectedFile, setSelectedFile] = React.useState()
1716
const [isSelected, setIsSelected] = React.useState(false)
1817
const [progress, setProgress] = React.useState(0)
1918
const [uploadRate, setUploadRate] = React.useState()
20-
const app_config = getSetting('app_config')
2119
const uiConfig = getSetting('ui_config')
2220

2321
const changeHandler = (event) => {
@@ -69,19 +67,19 @@ const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fet
6967
const formData = new FormData()
7068
formData.append('file', selectedFile)
7169
try {
72-
if (publicUpload) {
73-
await VideoService.publicUpload(formData, uploadProgress)
74-
}
75-
if (!publicUpload && authenticated) {
70+
if (authenticated) {
7671
await VideoService.upload(formData, uploadProgress)
72+
} else {
73+
await VideoService.publicUpload(formData, uploadProgress)
7774
}
7875
handleAlert({
7976
type: 'success',
8077
message: 'Your upload will be available in a few seconds.',
8178
autohideDuration: 3500,
8279
open: true,
83-
onClose: () => fetchVideos(),
80+
// onClose: () => fetchVideos(),
8481
})
82+
setTimeout(() => window.dispatchEvent(new Event('transcodingStarted')), 5000)
8583
} catch (err) {
8684
handleAlert({
8785
type: 'error',
@@ -119,20 +117,18 @@ const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fet
119117
formData.append('lastModified', selectedFile.lastModified.toString());
120118
formData.append('fileType', selectedFile.type);
121119

122-
if (publicUpload) {
123-
await VideoService.publicUploadChunked(formData, uploadProgressChunked, selectedFile.size, start);
124-
} else if (!publicUpload && authenticated) {
125-
await VideoService.uploadChunked(formData, uploadProgressChunked, selectedFile.size, start);
126-
}
120+
authenticated ? await VideoService.uploadChunked(formData, uploadProgressChunked, selectedFile.size, start)
121+
: await VideoService.publicUploadChunked(formData, uploadProgressChunked, selectedFile.size, start)
127122
}
128123

129124
handleAlert({
130125
type: 'success',
131126
message: 'Your upload will be available in a few seconds.',
132127
autohideDuration: 3500,
133128
open: true,
134-
onClose: () => fetchVideos(),
129+
// onClose: () => fetchVideos(),
135130
});
131+
setTimeout(() => window.dispatchEvent(new Event('transcodingStarted')), 5000)
136132
} catch (err) {
137133
handleAlert({
138134
type: 'error',
@@ -155,21 +151,18 @@ const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fet
155151
// eslint-disable-next-line
156152
}, [selectedFile])
157153

158-
if (feedView && !uiConfig?.allow_public_upload) return null
159-
if (!feedView && !uiConfig?.show_admin_upload) return null
154+
if (!authenticated && !uiConfig?.allow_public_upload) return null
155+
if (authenticated && !uiConfig?.show_admin_upload) return null
160156

161157
return (
162-
<Grid item sx={{ ml: 0.75, mr: 0.75, mb: 3 }}>
163-
{reserveDateSpace && (
164-
<Box sx={{ height: 20, mb: 1 }} />
165-
)}
158+
<Grid item sx={{ mx: 1, mt: 2 }}>
166159
<label htmlFor="icon-button-file">
167160
{/* Add onDrop and onDragOver handlers */}
168161
<Paper
169162
sx={{
170163
position: 'relative',
171-
width: cardWidth,
172-
height: cardHeight,
164+
width: '100%',
165+
height: '50px',
173166
cursor: 'pointer',
174167
background: 'rgba(0,0,0,0)',
175168
overflow: 'hidden',
@@ -178,8 +171,8 @@ const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fet
178171
onDrop={dropHandler}
179172
onDragOver={dragOverHandler}
180173
>
181-
<Box sx={{ display: 'flex', p: 2, height: '100%' }} justifyContent="center" alignItems="center">
182-
<Stack sx={{ zIndex: 0, width: '100%' }} alignItems="center">
174+
<Box sx={{ display: 'flex', p: 1, height: '100%' }} justifyContent="center" alignItems="center">
175+
<Stack sx={{ zIndex: 0, width: '100%' }} alignItems="center" justifyContent="center">
183176
{!isSelected && (
184177
<Input
185178
id="icon-button-file"
@@ -189,20 +182,27 @@ const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fet
189182
onChange={changeHandler}
190183
/>
191184
)}
192-
<CloudUploadIcon sx={{ fontSize: 75 }} />
185+
{progress === 0 && !mini && <CloudUploadIcon sx={{ fontSize: 32 }} />}
186+
{progress === 0 && mini && progress === 0 && <CloudUploadIcon sx={{ fontSize: 20 }} />}
193187
{progress !== 0 && progress !== 1 && (
194188
<>
195-
<Typography component="div" variant="overline" align="center" sx={{ fontWeight: 600, fontSize: 16 }}>
196-
Uploading... {(100 * progress).toFixed(0)}%
197-
</Typography>
198-
<Typography variant="overline" align="center" sx={{ fontWeight: 600, fontSize: 12 }}>
199-
{numberFormat.format(uploadRate.loaded.toFixed(0))} /{' '}
200-
{numberFormat.format(uploadRate.total.toFixed(0))} MB's
201-
</Typography>
189+
{!mini ?
190+
<>
191+
<Typography component="div" variant="overline" align="center" sx={{ fontWeight: 600, fontSize: 12 }}>
192+
Uploading... {(100 * progress).toFixed(0)}%
193+
</Typography>
194+
<Typography variant="overline" align="center" sx={{ fontWeight: 600, fontSize: 12 }}>
195+
{numberFormat.format(uploadRate.loaded.toFixed(0))} /{' '}
196+
{numberFormat.format(uploadRate.total.toFixed(0))} MB's
197+
</Typography>
198+
</> : <Typography component="div" variant="overline" align="center" justifyItems="center" sx={{ fontWeight: 600, fontSize: 12 }}>
199+
{(100 * progress).toFixed(0)}%
200+
</Typography>
201+
}
202202
</>
203203
)}
204-
{progress === 1 && (
205-
<Typography component="div" variant="overline" align="center" sx={{ fontWeight: 600, fontSize: 16 }}>
204+
{progress === 1 && !mini && (
205+
<Typography component="div" variant="overline" align="center" sx={{ fontWeight: 600, fontSize: 12 }}>
206206
Processing...
207207
<Typography
208208
component="span"
@@ -215,15 +215,20 @@ const UploadCard = ({ authenticated, feedView = false, publicUpload = false, fet
215215
</Typography>
216216
</Typography>
217217
)}
218+
{progress === 1 && mini && (
219+
<Typography component="div" variant="overline" align="center" justifyItems="center" sx={{ fontWeight: 600, fontSize: 12 }}>
220+
100%
221+
</Typography>
222+
)}
218223
</Stack>
219224
</Box>
220225
<Box
221226
sx={{
222227
position: 'absolute',
223228
bottom: 0,
224229
zIndex: -1,
225-
height: cardHeight,
226-
width: cardWidth * progress,
230+
height: mini ? `${progress * 100}%` : '100%',
231+
width: mini ? '100%' : `${progress * 100}%`,
227232
backgroundImage: 'linear-gradient(90deg, #BC00E6DF, #FF3729D9)',
228233
borderRadius: '10px',
229234
}}

app/client/src/components/admin/VideoCards.js

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import VisibilityCard from './VisibilityCard'
55
import VideoModal from '../modal/VideoModal'
66
import SensorsIcon from '@mui/icons-material/Sensors'
77
import { VideoService } from '../../services'
8-
import UploadCard from './UploadCard'
98
import { formatDate } from '../../common/utils'
109

1110
const getDateKey = (video) => {
@@ -18,8 +17,6 @@ const VideoCards = ({
1817
videos,
1918
loadingIcon = null,
2019
feedView = false,
21-
showUploadCard = false,
22-
fetchVideos,
2320
authenticated,
2421
size,
2522
editMode = false,
@@ -121,17 +118,6 @@ const VideoCards = ({
121118
)}
122119
{loadingIcon}
123120
</Grid>
124-
{!loadingIcon && (
125-
<Grid container justifyContent="center">
126-
<UploadCard
127-
authenticated={authenticated}
128-
feedView={feedView}
129-
cardWidth={250}
130-
handleAlert={memoizedHandleAlert}
131-
publicUpload={feedView}
132-
/>
133-
</Grid>
134-
)}
135121
</Paper>
136122
)
137123

@@ -157,25 +143,13 @@ const VideoCards = ({
157143
{(!vids || vids.length === 0) && EMPTY_STATE()}
158144
{vids && vids.length !== 0 && (
159145
<Grid container justifyContent="flex-start">
160-
{showUploadCard && (
161-
<UploadCard
162-
authenticated={authenticated}
163-
feedView={feedView}
164-
cardWidth={size}
165-
handleAlert={memoizedHandleAlert}
166-
fetchVideos={fetchVideos}
167-
publicUpload={feedView}
168-
reserveDateSpace={showDateHeaders}
169-
/>
170-
)}
171146
{(() => {
172147
// Pre-compute counts per date
173148
const dateCounts = {}
174149
vids.forEach((video) => {
175150
const key = getDateKey(video)
176151
dateCounts[key] = (dateCounts[key] || 0) + 1
177152
})
178-
const firstDateKey = vids.length > 0 ? getDateKey(vids[0]) : null
179153

180154
return vids.map((v, index) => {
181155
const currentDateKey = getDateKey(v)
@@ -185,15 +159,13 @@ const VideoCards = ({
185159
const isLastOfDate = currentDateKey !== nextDateKey
186160
const formattedDate = currentDateKey !== 'unknown' ? formatDate(currentDateKey) : 'Unknown Date'
187161
const hasManyclips = dateCounts[currentDateKey] >= 6
188-
// When upload card is shown, first date group uses inline labels to flow with it
189-
const isFirstDateGroup = showUploadCard && currentDateKey === firstDateKey
190162
// Insert flex break after a large date group ends to keep it isolated
191163
// (applies even to first date group - it flows with upload card but still needs isolation from next date)
192164
const needsBreakAfter = showDateHeaders && isLastOfDate && hasManyclips && nextDateKey !== null
193165

194166
return (
195167
<React.Fragment key={v.path + v.video_id}>
196-
{isNewDate && hasManyclips && !isFirstDateGroup && (
168+
{isNewDate && hasManyclips && (
197169
<Box
198170
sx={{
199171
width: '100%',
@@ -219,8 +191,8 @@ const VideoCards = ({
219191
editMode={editMode}
220192
isSelected={selectedVideos.has(v.video_id)}
221193
onSelect={onVideoSelect}
222-
dateLabel={isNewDate && (!hasManyclips || isFirstDateGroup) ? formattedDate : null}
223-
reserveDateSpace={showDateHeaders && (!hasManyclips || isFirstDateGroup)}
194+
dateLabel={isNewDate && !hasManyclips ? formattedDate : null}
195+
reserveDateSpace={showDateHeaders && !hasManyclips}
224196
/>
225197
{needsBreakAfter && (
226198
<Box sx={{ flexBasis: '100%', height: 0 }} />

0 commit comments

Comments
 (0)