Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
SLOBS-Release committed Feb 6, 2025
2 parents ad056c6 + 9bd1a1a commit 9e0eb59
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
8 changes: 1 addition & 7 deletions app/components-react/root/LiveDock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import * as remote from '@electron/remote';
import cx from 'classnames';
import Animation from 'rc-animate';
import { Menu } from 'antd';
import { Button, Menu } from 'antd';
import pick from 'lodash/pick';
import { initStore, useController } from 'components-react/hooks/zustand';
import { EStreamingState } from 'services/streaming';
Expand Down Expand Up @@ -346,12 +346,6 @@ function LiveDock(p: { onLeft: boolean }) {

const chat = useMemo(() => {
const primaryChat = Services.UserService.state.auth!.primaryPlatform;
const showTiktokInfo =
visibleChat === 'tiktok' || (visibleChat === 'default' && primaryChat === 'tiktok');

if (showTiktokInfo) {
return <TikTokChatInfo />;
}

const showInstagramInfo = primaryChat === 'instagram';
if (showInstagramInfo) {
Expand Down
2 changes: 1 addition & 1 deletion app/components-react/windows/go-live/GameSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function GameSelector(p: TProps) {
}}
filterOption={filterOption}
debounce={500}
required={isTwitch || isTrovo}
required={isTwitch || isTrovo || isKick}
hasImage={isTwitch || isTrovo || isKick}
onBeforeSearch={onBeforeSearchHandler}
imageSize={platformService.gameImageSize}
Expand Down
10 changes: 4 additions & 6 deletions app/services/platforms/kick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ export class KickService
const body = new FormData();
body.append('title', opts.title);

if (opts.game !== '') {
body.append('category', opts.game);
}
const game = opts.game === '' ? '15' : opts.game;
body.append('category', game);

const request = new Request(url, { headers, method: 'POST', body });

Expand Down Expand Up @@ -325,6 +324,7 @@ export class KickService
return jfetch<IKickStreamInfoResponse>(request)
.then(async res => {
const data = res as IKickStreamInfoResponse;
console.log('data', JSON.stringify(data, null, 2));

if (data.categories && data.categories.length > 0) {
const games = await Promise.all(
Expand Down Expand Up @@ -376,9 +376,7 @@ export class KickService

const params = new URLSearchParams();
params.append('title', settings.title);
if (settings.game !== '') {
params.append('category', settings.game);
}
params.append('category', settings.game);

const request = new Request(url, { headers, method: 'PUT', body: params.toString() });

Expand Down
21 changes: 18 additions & 3 deletions app/services/platforms/tiktok.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ interface ITikTokServiceState extends IPlatformState {
gameName: string;
dateDenied?: string | null;
audienceControlsInfo: ITikTokAudienceControls;
chatUrl: string;
}

interface ITikTokStartStreamSettings {
Expand Down Expand Up @@ -104,6 +105,7 @@ export class TikTokService
username: '',
gameName: '',
audienceControlsInfo: { disable: true, audienceType: '0', types: [] },
chatUrl: '',
};

@Inject() windowsService: WindowsService;
Expand Down Expand Up @@ -216,6 +218,10 @@ export class TikTokService
throwStreamError('TIKTOK_GENERATE_CREDENTIALS_FAILED');
}

if (streamInfo?.chat_url) {
this.SET_CHAT_URL(streamInfo.chat_url);
}

ttSettings.serverUrl = streamInfo.rtmp;
ttSettings.streamKey = streamInfo.key;

Expand Down Expand Up @@ -468,6 +474,10 @@ export class TikTokService
return EPlatformCallResult.TikTokStreamScopeMissing;
}

if (status?.info.chatUrl) {
this.SET_CHAT_URL(status.info.chatUrl);
}

// clear any leftover server url or stream key
if (this.state.settings?.serverUrl || this.state.settings?.streamKey) {
await this.putChannelInfo({
Expand Down Expand Up @@ -537,9 +547,9 @@ export class TikTokService
games.push(this.defaultGame);
return games;
})
.catch(e => {
.catch((e: unknown) => {
console.error('Error fetching TikTok categories: ', e);
return [];
return [] as IGame[];
});
}

Expand Down Expand Up @@ -613,7 +623,7 @@ export class TikTokService
}

get chatUrl(): string {
return '';
return `${this.state.chatUrl}?lang=${this.locale}`;
}

// url for the live monitor
Expand Down Expand Up @@ -852,4 +862,9 @@ export class TikTokService
protected SET_AUDIENCE_CONTROLS(audienceControlsInfo: ITikTokAudienceControls) {
this.state.audienceControlsInfo = audienceControlsInfo;
}

@mutation()
protected SET_CHAT_URL(chatUrl: string) {
this.state.chatUrl = chatUrl;
}
}
10 changes: 8 additions & 2 deletions app/services/platforms/tiktok/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ export enum ETikTokErrorTypes {
}

export interface ITikTokStartStreamResponse {
key: string;
rtmp: string;
id: string;
rtmp: string;
key: string;
chat_url?: string | null;
broadcast_id?: string | null;
channel_name?: string | null;
platform_id?: string | null;
region?: string | null;
chat_id?: string | null;
}

export interface ITikTokEndStreamResponse {
Expand Down

0 comments on commit 9e0eb59

Please sign in to comment.