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