Skip to content

Commit bb89d04

Browse files
author
lijiahao
committed
Fix error on xcloud list page
1 parent ac1133d commit bb89d04

File tree

19 files changed

+368
-37
lines changed

19 files changed

+368
-37
lines changed

app/background.js

Lines changed: 202 additions & 13 deletions
Large diffs are not rendered by default.

app/preload.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flatpak/io.github.Geocld.XStreamingDesktop.metainfo.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
</screenshot>
3535
</screenshots>
3636
<releases>
37+
<release version="1.8.1" date="2025-07-04">
38+
<description>
39+
<ul>
40+
<li>Fixed:</li>
41+
<li>xCloud list show error issue.</li>
42+
</ul>
43+
</description>
44+
</release>
3745
<release version="1.8.0" date="2025-07-03">
3846
<description>
3947
<ul>

main/helpers/streammanager.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,15 @@ export default class StreamManager {
255255
})
256256
})
257257
}
258+
259+
getConsoles() {
260+
console.log('getConsoles11111')
261+
return new Promise((resolve) => {
262+
this.getApi('home').getConsoles().then((result) => {
263+
resolve(result)
264+
}).catch(() => {
265+
resolve([])
266+
})
267+
})
268+
}
258269
}

main/helpers/xcloudapi.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import https from "https";
22
import Application from "../application";
33
import { Address6 } from "ip-address";
4+
import axios from 'axios';
45
import { defaultSettings } from "../../renderer/context/userContext.defaults";
56

67
export interface playResult {
@@ -531,6 +532,73 @@ export default class xCloudApi {
531532
return this.get("/v5/sessions/" + this._type + "/active");
532533
}
533534

535+
getConsoles() {
536+
return new Promise((resolve) => {
537+
const deviceInfo = JSON.stringify({
538+
appInfo: {
539+
env: {
540+
clientAppId: 'www.xbox.com',
541+
clientAppType: 'browser',
542+
clientAppVersion: '26.1.97',
543+
clientSdkVersion: '10.3.7',
544+
httpEnvironment: 'prod',
545+
sdkInstallId: '',
546+
},
547+
},
548+
dev: {
549+
hw: {
550+
make: 'Microsoft',
551+
// 'model': 'Surface Pro',
552+
model: 'unknown',
553+
// 'sdktype': 'native',
554+
sdktype: 'web',
555+
},
556+
os: {
557+
name: 'windows',
558+
ver: '22631.2715',
559+
platform: 'desktop',
560+
},
561+
displayInfo: {
562+
dimensions: {
563+
widthInPixels: 1920,
564+
heightInPixels: 1080,
565+
},
566+
pixelDensity: {
567+
dpiX: 1,
568+
dpiY: 1,
569+
},
570+
},
571+
browser: {
572+
browserName: 'chrome',
573+
browserVersion: '130.0',
574+
},
575+
},
576+
});
577+
const host = this._host.startsWith('http') ? this._host : 'https://' + this._host;
578+
axios
579+
.get(`${host}/v6/servers/home?mr=50`, {
580+
headers: {
581+
'Content-Type': 'application/json',
582+
'X-MS-Device-Info': deviceInfo,
583+
Authorization: 'Bearer ' + this._token,
584+
},
585+
timeout: 15 * 1000
586+
})
587+
.then(res => {
588+
console.log('[xcloudapi.ts] getConsoles res:', res.data);
589+
if (res.data && res.data.results) {
590+
resolve(res.data.results);
591+
} else {
592+
resolve([]);
593+
}
594+
})
595+
.catch(e => {
596+
console.log('get consoles error:', e)
597+
resolve([]);
598+
});
599+
});
600+
}
601+
534602
inputConfigs(xboxTitleId: string) {
535603
console.log('xboxTitleId:', xboxTitleId)
536604
const settings: any = this._application._store.get(

main/ipc/streaming.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,8 @@ export default class IpcStreaming extends IpcBase {
8181
return this._streamManager.inputConfigs(args.xboxTitleId)
8282
}
8383

84+
getConsoles() {
85+
return this._streamManager.getConsoles()
86+
}
87+
8488
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"name": "xstreaming",
44
"description": "xstreaming",
5-
"version": "1.8.0",
5+
"version": "1.8.1",
66
"author": "Geocld <lijiahao5372@gmail.com>",
77
"main": "app/background.js",
88
"scripts": {

renderer/components/Loading.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
right:0;
55
bottom: 0;
66
top: 0;
7+
z-index: 999;
78
display: flex;
89
flex-direction: column;
910
justify-content: center;
1011
align-items: center;
12+
background: rgba(0, 0, 0, .2);
1113
}
1214

1315
.loading img {

renderer/components/Nav.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ import {
1010
Dropdown,
1111
DropdownMenu,
1212
Avatar,
13+
Popover,
14+
PopoverTrigger,
15+
PopoverContent,
16+
Button
1317
} from "@nextui-org/react";
1418

1519
import { useTranslation } from "next-i18next";
1620

1721
import Ipc from "../lib/ipc";
22+
import updater from "../lib/updater";
23+
import pkg from '../../package.json';
1824

1925
const Nav = ({ current, isLogined }) => {
2026
console.log("isLogined:", isLogined);
2127

2228
const { t, i18n: {language: locale} } = useTranslation("common");
2329
const [userState, setUserState] = useState(null);
30+
const [newVersions, setNewVersions] = useState(null);
2431

2532
const metas = [
2633
{
@@ -51,6 +58,12 @@ const Nav = ({ current, isLogined }) => {
5158
setUserState(res.user)
5259
}
5360
});
61+
62+
updater().then((infos: any) => {
63+
if (infos) {
64+
setNewVersions(infos)
65+
}
66+
})
5467
}, [isLogined])
5568

5669
const handleLouout = () => {
@@ -68,7 +81,29 @@ const Nav = ({ current, isLogined }) => {
6881
return (
6982
<Navbar isBordered maxWidth="full" style={{ justifyContent: "flex-start", zIndex: 100 }}>
7083
<NavbarBrand className="grow-0">
71-
<p className="font-bold text-inherit pr-20">XStreaming</p>
84+
<p className="font-bold text-inherit pr-20">
85+
XStreaming
86+
87+
{
88+
newVersions ? (
89+
<Popover color="default" placement="bottom">
90+
<PopoverTrigger>
91+
<Button color="success" size="sm" variant="light">
92+
{t('newVersion')}
93+
</Button>
94+
</PopoverTrigger>
95+
<PopoverContent>
96+
<div className="px-1 py-2">
97+
<div className="text-small">{t('curVerson')}: <span className="text-yellow-500 pl-1">v{newVersions.version}</span></div>
98+
<div className="text-small">{t('latestVerson')}: <span className="text-green-500 pl-1">v{newVersions.latestVer}</span></div>
99+
</div>
100+
</PopoverContent>
101+
</Popover>
102+
) : (
103+
<span className="text-small pl-2 text-gray-500">v{ pkg.version }</span>
104+
)
105+
}
106+
</p>
72107
</NavbarBrand>
73108
<NavbarContent className="hidden sm:flex gap-4" justify="start">
74109
{metas.map((meta) => {

renderer/components/TitleItem.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ function TitleItem(props) {
2121
<Card className="mb-5" shadow="sm" isPressable onClick={handleClick}>
2222
<CardBody className="overflow-visible py-2">
2323
<div className="relative">
24-
<Image
25-
alt="Card background"
26-
className="object-cover rounded-xl"
27-
src={"https:" + titleItem.Image_Tile.URL}
28-
width={270}
29-
/>
24+
{
25+
titleItem.Image_Tile && (<Image
26+
alt="Card background"
27+
className="object-cover rounded-xl"
28+
src={"https:" + titleItem.Image_Tile.URL}
29+
width={270}
30+
/>)
31+
}
3032

3133
<div className="absolute bottom-0 right-0 flex flex-row justify-end z-40 space-x-2 px-2" style={{background: 'rgba(0, 0, 0, .7)'}}>
3234
<Image

0 commit comments

Comments
 (0)