@@ -1743,7 +1743,38 @@ app.put('/api/streams/:id', isAuthenticated, async (req, res) => {
17431743 const updateData = { } ;
17441744 if ( req . body . streamTitle ) updateData . title = req . body . streamTitle ;
17451745 if ( req . body . videoId ) updateData . video_id = req . body . videoId ;
1746- if ( req . body . rtmpUrl ) updateData . rtmp_url = req . body . rtmpUrl ;
1746+
1747+ if ( req . body . rtmpUrl ) {
1748+ updateData . rtmp_url = req . body . rtmpUrl ;
1749+
1750+ let platform = 'Custom' ;
1751+ let platform_icon = 'ti-broadcast' ;
1752+ if ( req . body . rtmpUrl . includes ( 'youtube.com' ) ) {
1753+ platform = 'YouTube' ;
1754+ platform_icon = 'ti-brand-youtube' ;
1755+ } else if ( req . body . rtmpUrl . includes ( 'facebook.com' ) ) {
1756+ platform = 'Facebook' ;
1757+ platform_icon = 'ti-brand-facebook' ;
1758+ } else if ( req . body . rtmpUrl . includes ( 'twitch.tv' ) ) {
1759+ platform = 'Twitch' ;
1760+ platform_icon = 'ti-brand-twitch' ;
1761+ } else if ( req . body . rtmpUrl . includes ( 'tiktok.com' ) ) {
1762+ platform = 'TikTok' ;
1763+ platform_icon = 'ti-brand-tiktok' ;
1764+ } else if ( req . body . rtmpUrl . includes ( 'instagram.com' ) ) {
1765+ platform = 'Instagram' ;
1766+ platform_icon = 'ti-brand-instagram' ;
1767+ } else if ( req . body . rtmpUrl . includes ( 'shopee.io' ) ) {
1768+ platform = 'Shopee Live' ;
1769+ platform_icon = 'ti-brand-shopee' ;
1770+ } else if ( req . body . rtmpUrl . includes ( 'restream.io' ) ) {
1771+ platform = 'Restream.io' ;
1772+ platform_icon = 'ti-live-photo' ;
1773+ }
1774+ updateData . platform = platform ;
1775+ updateData . platform_icon = platform_icon ;
1776+ }
1777+
17471778 if ( req . body . streamKey ) updateData . stream_key = req . body . streamKey ;
17481779 if ( req . body . bitrate ) updateData . bitrate = parseInt ( req . body . bitrate ) ;
17491780 if ( req . body . resolution ) updateData . resolution = req . body . resolution ;
@@ -1755,6 +1786,12 @@ app.put('/api/streams/:id', isAuthenticated, async (req, res) => {
17551786 if ( req . body . useAdvancedSettings !== undefined ) {
17561787 updateData . use_advanced_settings = req . body . useAdvancedSettings === 'true' || req . body . useAdvancedSettings === true ;
17571788 }
1789+ if ( req . body . duration !== undefined && req . body . duration !== null && req . body . duration !== '' ) {
1790+ updateData . duration = parseInt ( req . body . duration ) ;
1791+ } else if ( 'duration' in req . body && ! req . body . duration ) {
1792+ updateData . duration = null ;
1793+ }
1794+
17581795 if ( req . body . scheduleTime ) {
17591796 const scheduleDate = new Date ( req . body . scheduleTime ) ;
17601797
0 commit comments