mirror of https://github.com/jetkvm/kvm.git
Compare commits
1 Commits
d38108d42e
...
d4528d8c18
| Author | SHA1 | Date |
|---|---|---|
|
|
d4528d8c18 |
|
|
@ -178,7 +178,6 @@ func getDefaultConfig() Config {
|
|||
return c
|
||||
}(),
|
||||
DefaultLogLevel: "INFO",
|
||||
VideoQualityFactor: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ void jetkvm_video_stop() {
|
|||
}
|
||||
|
||||
int jetkvm_video_set_quality_factor(float quality_factor) {
|
||||
if (quality_factor <= 0 || quality_factor > 1) {
|
||||
if (quality_factor < 0 || quality_factor > 1) {
|
||||
return -1;
|
||||
}
|
||||
video_set_quality_factor(quality_factor);
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ int video_init(float factor)
|
|||
{
|
||||
detect_sleep_mode();
|
||||
|
||||
if (factor <= 0 || factor > 1) {
|
||||
if (factor < 0 || factor > 1) {
|
||||
factor = 1.0f;
|
||||
}
|
||||
quality_factor = factor;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ func NewNative(opts NativeOptions) *Native {
|
|||
sleepModeSupported := isSleepModeSupported()
|
||||
|
||||
defaultQualityFactor := opts.DefaultQualityFactor
|
||||
if defaultQualityFactor <= 0 || defaultQualityFactor > 1 {
|
||||
if defaultQualityFactor < 0 || defaultQualityFactor > 1 {
|
||||
defaultQualityFactor = 1.0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,8 +177,10 @@ func rpcReboot(force bool) error {
|
|||
return hwReboot(force, nil, 0)
|
||||
}
|
||||
|
||||
var streamFactor = 1.0
|
||||
|
||||
func rpcGetStreamQualityFactor() (float64, error) {
|
||||
return config.VideoQualityFactor, nil
|
||||
return streamFactor, nil
|
||||
}
|
||||
|
||||
func rpcSetStreamQualityFactor(factor float64) error {
|
||||
|
|
@ -188,10 +190,7 @@ func rpcSetStreamQualityFactor(factor float64) error {
|
|||
return err
|
||||
}
|
||||
|
||||
config.VideoQualityFactor = factor
|
||||
if err := SaveConfig(); err != nil {
|
||||
return fmt.Errorf("failed to save config: %w", err)
|
||||
}
|
||||
streamFactor = factor
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ export async function checkDeviceAuth() {
|
|||
.GET(`${DEVICE_API}/device/status`)
|
||||
.then(res => res.json() as Promise<DeviceStatus>);
|
||||
|
||||
if (!res.isSetup) throw redirect("/welcome");
|
||||
if (!res.isSetup) return redirect("/welcome");
|
||||
|
||||
const deviceRes = await api.GET(`${DEVICE_API}/device`);
|
||||
if (deviceRes.status === 401) throw redirect("/login-local");
|
||||
if (deviceRes.status === 401) return redirect("/login-local");
|
||||
if (deviceRes.ok) {
|
||||
const device = (await deviceRes.json()) as LocalDevice;
|
||||
return { authMode: device.authMode };
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ const loader: LoaderFunction = async ({ params }: LoaderFunctionArgs) => {
|
|||
return { device, user };
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { user };
|
||||
return { devices: [] };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ const loader: LoaderFunction = async ({ params }: LoaderFunctionArgs) => {
|
|||
return { device, user };
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { user };
|
||||
return { devices: [] };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,8 +78,10 @@ const deviceLoader = async () => {
|
|||
|
||||
const cloudLoader = async (params: Params<string>): Promise<CloudLoaderResp> => {
|
||||
const user = await checkAuth();
|
||||
|
||||
const iceResp = await api.POST(`${CLOUD_API}/webrtc/ice_config`);
|
||||
const iceConfig = await iceResp.json();
|
||||
|
||||
const deviceResp = await api.GET(`${CLOUD_API}/devices/${params.id}`);
|
||||
|
||||
if (!deviceResp.ok) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const loader: LoaderFunction = async () => {
|
|||
return { devices, user };
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { devices: [], user };
|
||||
return { devices: [] };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue