mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Add support for manipulationFlags
This commit is contained in:
parent
45f8a25b8b
commit
acdec990ea
22 changed files with 306 additions and 19 deletions
|
@ -411,6 +411,9 @@
|
|||
},
|
||||
"isQOrLaterNow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"addedManipulationFlags": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
|
|
@ -487,6 +487,9 @@
|
|||
},
|
||||
"ignoreHadManipulationFlags": {
|
||||
"type": "number"
|
||||
},
|
||||
"ignoreManipulationFlags": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
|
|
@ -182,6 +182,9 @@
|
|||
},
|
||||
"qOrLater": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mFlags": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -206,6 +209,7 @@
|
|||
"hadManipulation",
|
||||
"hadManipulationFlags",
|
||||
"isUserKeptSignedIn",
|
||||
"mFlags",
|
||||
"model",
|
||||
"name",
|
||||
"networkTime",
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Untitled number in SerializedAppLogicAction Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/addedManipulationFlags
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :---------------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [SerializedAppLogicAction.schema.json\*](SerializedAppLogicAction.schema.json "open original schema") |
|
||||
|
||||
## addedManipulationFlags Type
|
||||
|
||||
`number`
|
|
@ -27,6 +27,7 @@ https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDevic
|
|||
| [appVersion](#appversion) | `number` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-appversion.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/appVersion") |
|
||||
| [didReboot](#didreboot) | `boolean` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-didreboot.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/didReboot") |
|
||||
| [isQOrLaterNow](#isqorlaternow) | `boolean` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-isqorlaternow.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/isQOrLaterNow") |
|
||||
| [addedManipulationFlags](#addedmanipulationflags) | `number` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-addedmanipulationflags.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/addedManipulationFlags") |
|
||||
|
||||
## type
|
||||
|
||||
|
@ -238,3 +239,21 @@ https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDevic
|
|||
### isQOrLaterNow Type
|
||||
|
||||
`boolean`
|
||||
|
||||
## addedManipulationFlags
|
||||
|
||||
|
||||
|
||||
`addedManipulationFlags`
|
||||
|
||||
* is optional
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-addedmanipulationflags.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/addedManipulationFlags")
|
||||
|
||||
### addedManipulationFlags Type
|
||||
|
||||
`number`
|
||||
|
|
|
@ -811,6 +811,7 @@ Reference this group by using
|
|||
| [appVersion](#appversion) | `number` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-appversion.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/appVersion") |
|
||||
| [didReboot](#didreboot) | `boolean` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-didreboot.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/didReboot") |
|
||||
| [isQOrLaterNow](#isqorlaternow) | `boolean` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-isqorlaternow.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/isQOrLaterNow") |
|
||||
| [addedManipulationFlags](#addedmanipulationflags) | `number` | Optional | cannot be null | [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-addedmanipulationflags.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/addedManipulationFlags") |
|
||||
|
||||
### type
|
||||
|
||||
|
@ -1022,3 +1023,21 @@ Reference this group by using
|
|||
#### isQOrLaterNow Type
|
||||
|
||||
`boolean`
|
||||
|
||||
### addedManipulationFlags
|
||||
|
||||
|
||||
|
||||
`addedManipulationFlags`
|
||||
|
||||
* is optional
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [SerializedAppLogicAction](serializedapplogicaction-definitions-serializedupdatedevicestatusaction-properties-addedmanipulationflags.md "https://timelimit.io/SerializedAppLogicAction#/definitions/SerializedUpdateDeviceStatusAction/properties/addedManipulationFlags")
|
||||
|
||||
#### addedManipulationFlags Type
|
||||
|
||||
`number`
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Untitled number in SerializedParentAction Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreManipulationFlags
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :------------------------------------------------------------------------------------------------ |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [SerializedParentAction.schema.json\*](SerializedParentAction.schema.json "open original schema") |
|
||||
|
||||
## ignoreManipulationFlags Type
|
||||
|
||||
`number`
|
|
@ -30,6 +30,7 @@ https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipul
|
|||
| [overlay](#overlay) | `boolean` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-overlay.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/overlay") |
|
||||
| [accessibilityService](#accessibilityservice) | `boolean` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-accessibilityservice.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/accessibilityService") |
|
||||
| [ignoreHadManipulationFlags](#ignorehadmanipulationflags) | `number` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-ignorehadmanipulationflags.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreHadManipulationFlags") |
|
||||
| [ignoreManipulationFlags](#ignoremanipulationflags) | `number` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-ignoremanipulationflags.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreManipulationFlags") |
|
||||
|
||||
## type
|
||||
|
||||
|
@ -254,3 +255,21 @@ https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipul
|
|||
### ignoreHadManipulationFlags Type
|
||||
|
||||
`number`
|
||||
|
||||
## ignoreManipulationFlags
|
||||
|
||||
|
||||
|
||||
`ignoreManipulationFlags`
|
||||
|
||||
* is optional
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-ignoremanipulationflags.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreManipulationFlags")
|
||||
|
||||
### ignoreManipulationFlags Type
|
||||
|
||||
`number`
|
||||
|
|
|
@ -1172,6 +1172,7 @@ Reference this group by using
|
|||
| [overlay](#overlay) | `boolean` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-overlay.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/overlay") |
|
||||
| [accessibilityService](#accessibilityservice) | `boolean` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-accessibilityservice.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/accessibilityService") |
|
||||
| [ignoreHadManipulationFlags](#ignorehadmanipulationflags) | `number` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-ignorehadmanipulationflags.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreHadManipulationFlags") |
|
||||
| [ignoreManipulationFlags](#ignoremanipulationflags) | `number` | Optional | cannot be null | [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-ignoremanipulationflags.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreManipulationFlags") |
|
||||
|
||||
### type
|
||||
|
||||
|
@ -1397,6 +1398,24 @@ Reference this group by using
|
|||
|
||||
`number`
|
||||
|
||||
### ignoreManipulationFlags
|
||||
|
||||
|
||||
|
||||
`ignoreManipulationFlags`
|
||||
|
||||
* is optional
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [SerializedParentAction](serializedparentaction-definitions-serializedignoremanipulationaction-properties-ignoremanipulationflags.md "https://timelimit.io/SerializedParentAction#/definitions/SerializedIgnoreManipulationAction/properties/ignoreManipulationFlags")
|
||||
|
||||
#### ignoreManipulationFlags Type
|
||||
|
||||
`number`
|
||||
|
||||
## Definitions group SerializedIncrementCategoryExtraTimeAction
|
||||
|
||||
Reference this group by using
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Untitled number in ServerDataStatus Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/mFlags
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :------------------------------------------------------------------------------------ |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [ServerDataStatus.schema.json\*](ServerDataStatus.schema.json "open original schema") |
|
||||
|
||||
## mFlags Type
|
||||
|
||||
`number`
|
|
@ -48,6 +48,7 @@ https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData
|
|||
| [wasAsEnabled](#wasasenabled) | `boolean` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-wasasenabled.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/wasAsEnabled") |
|
||||
| [activityLevelBlocking](#activitylevelblocking) | `boolean` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-activitylevelblocking.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/activityLevelBlocking") |
|
||||
| [qOrLater](#qorlater) | `boolean` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-qorlater.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/qOrLater") |
|
||||
| [mFlags](#mflags) | `number` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-mflags.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/mFlags") |
|
||||
|
||||
## deviceId
|
||||
|
||||
|
@ -680,3 +681,21 @@ https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData
|
|||
### qOrLater Type
|
||||
|
||||
`boolean`
|
||||
|
||||
## mFlags
|
||||
|
||||
|
||||
|
||||
`mFlags`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-mflags.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/mFlags")
|
||||
|
||||
### mFlags Type
|
||||
|
||||
`number`
|
||||
|
|
|
@ -338,6 +338,7 @@ Reference this group by using
|
|||
| [wasAsEnabled](#wasasenabled) | `boolean` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-wasasenabled.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/wasAsEnabled") |
|
||||
| [activityLevelBlocking](#activitylevelblocking) | `boolean` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-activitylevelblocking.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/activityLevelBlocking") |
|
||||
| [qOrLater](#qorlater) | `boolean` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-qorlater.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/qOrLater") |
|
||||
| [mFlags](#mflags) | `number` | Required | cannot be null | [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-mflags.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/mFlags") |
|
||||
|
||||
### deviceId
|
||||
|
||||
|
@ -971,6 +972,24 @@ Reference this group by using
|
|||
|
||||
`boolean`
|
||||
|
||||
### mFlags
|
||||
|
||||
|
||||
|
||||
`mFlags`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [ServerDataStatus](serverdatastatus-definitions-serverdevicedata-properties-mflags.md "https://timelimit.io/ServerDataStatus#/definitions/ServerDeviceData/properties/mFlags")
|
||||
|
||||
#### mFlags Type
|
||||
|
||||
`number`
|
||||
|
||||
## Definitions group ProtectionLevel
|
||||
|
||||
Reference this group by using
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -33,11 +33,13 @@ export class IgnoreManipulationAction extends ParentAction {
|
|||
readonly ignoreDidReboot: boolean
|
||||
readonly ignoreHadManipulation: boolean
|
||||
readonly ignoreHadManipulationFlags: number
|
||||
readonly ignoreManipulationFlags: number
|
||||
|
||||
constructor ({
|
||||
deviceId, ignoreDeviceAdminManipulation, ignoreDeviceAdminManipulationAttempt,
|
||||
ignoreAppDowngrade, ignoreNotificationAccessManipulation, ignoreUsageStatsAccessManipulation,
|
||||
ignoreOverlayPermissionManipulation, ignoreAccessibilityServiceManipulation, ignoreDidReboot, ignoreHadManipulation, ignoreHadManipulationFlags
|
||||
ignoreOverlayPermissionManipulation, ignoreAccessibilityServiceManipulation, ignoreDidReboot,
|
||||
ignoreHadManipulation, ignoreHadManipulationFlags, ignoreManipulationFlags
|
||||
}: {
|
||||
deviceId: string
|
||||
ignoreDeviceAdminManipulation: boolean
|
||||
|
@ -50,6 +52,7 @@ export class IgnoreManipulationAction extends ParentAction {
|
|||
ignoreDidReboot: boolean
|
||||
ignoreHadManipulation: boolean
|
||||
ignoreHadManipulationFlags: number
|
||||
ignoreManipulationFlags: number
|
||||
}) {
|
||||
super()
|
||||
|
||||
|
@ -63,6 +66,8 @@ export class IgnoreManipulationAction extends ParentAction {
|
|||
throwOutOfRange({ actionType, field: 'ignoreHadManipulationFlags', value: ignoreHadManipulationFlags })
|
||||
}
|
||||
|
||||
assertSafeInteger({ actionType, field: 'ignoreManipulationFlags', value: ignoreManipulationFlags })
|
||||
|
||||
this.deviceId = deviceId
|
||||
this.ignoreDeviceAdminManipulation = ignoreDeviceAdminManipulation
|
||||
this.ignoreDeviceAdminManipulationAttempt = ignoreDeviceAdminManipulationAttempt
|
||||
|
@ -74,9 +79,14 @@ export class IgnoreManipulationAction extends ParentAction {
|
|||
this.ignoreDidReboot = ignoreDidReboot
|
||||
this.ignoreHadManipulation = ignoreHadManipulation
|
||||
this.ignoreHadManipulationFlags = ignoreHadManipulationFlags
|
||||
this.ignoreManipulationFlags = ignoreManipulationFlags
|
||||
}
|
||||
|
||||
static parse = ({ deviceId, admin, adminA, downgrade, notification, usageStats, overlay, accessibilityService, reboot, hadManipulation, ignoreHadManipulationFlags }: SerializedIgnoreManipulationAction) => (
|
||||
static parse = ({
|
||||
deviceId, admin, adminA, downgrade, notification, usageStats, overlay,
|
||||
accessibilityService, reboot, hadManipulation, ignoreHadManipulationFlags,
|
||||
ignoreManipulationFlags
|
||||
}: SerializedIgnoreManipulationAction) => (
|
||||
new IgnoreManipulationAction({
|
||||
deviceId,
|
||||
ignoreDeviceAdminManipulation: admin,
|
||||
|
@ -88,7 +98,8 @@ export class IgnoreManipulationAction extends ParentAction {
|
|||
ignoreAccessibilityServiceManipulation: !!accessibilityService,
|
||||
ignoreDidReboot: !!reboot,
|
||||
ignoreHadManipulation: hadManipulation,
|
||||
ignoreHadManipulationFlags: ignoreHadManipulationFlags || 0
|
||||
ignoreHadManipulationFlags: ignoreHadManipulationFlags || 0,
|
||||
ignoreManipulationFlags: ignoreManipulationFlags || 0
|
||||
})
|
||||
)
|
||||
}
|
||||
|
@ -107,4 +118,5 @@ export interface SerializedIgnoreManipulationAction {
|
|||
overlay?: boolean
|
||||
accessibilityService?: boolean
|
||||
ignoreHadManipulationFlags?: number
|
||||
ignoreManipulationFlags?: number
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -32,6 +32,7 @@ export class UpdateDeviceStatusAction extends AppLogicAction {
|
|||
readonly newAppVersion?: number
|
||||
readonly didReboot: boolean
|
||||
readonly isQOrLaterNow: boolean
|
||||
readonly addedManipulationFlags: number
|
||||
|
||||
constructor ({
|
||||
newProtetionLevel,
|
||||
|
@ -41,7 +42,8 @@ export class UpdateDeviceStatusAction extends AppLogicAction {
|
|||
newAccessibilityServiceEnabled,
|
||||
newAppVersion,
|
||||
didReboot,
|
||||
isQOrLaterNow
|
||||
isQOrLaterNow,
|
||||
addedManipulationFlags
|
||||
}: {
|
||||
newProtetionLevel?: ProtectionLevel
|
||||
newUsageStatsPermissionStatus?: RuntimePermissionStatus
|
||||
|
@ -51,6 +53,7 @@ export class UpdateDeviceStatusAction extends AppLogicAction {
|
|||
newAppVersion?: number
|
||||
didReboot: boolean
|
||||
isQOrLaterNow: boolean
|
||||
addedManipulationFlags: number
|
||||
}) {
|
||||
super()
|
||||
|
||||
|
@ -62,6 +65,8 @@ export class UpdateDeviceStatusAction extends AppLogicAction {
|
|||
}
|
||||
}
|
||||
|
||||
assertSafeInteger({ actionType, field: 'addedManipulationFlags', value: addedManipulationFlags })
|
||||
|
||||
this.newProtetionLevel = newProtetionLevel
|
||||
this.newUsageStatsPermissionStatus = newUsageStatsPermissionStatus
|
||||
this.newNotificationAccessPermission = newNotificationAccessPermission
|
||||
|
@ -70,9 +75,20 @@ export class UpdateDeviceStatusAction extends AppLogicAction {
|
|||
this.newAppVersion = newAppVersion
|
||||
this.didReboot = didReboot
|
||||
this.isQOrLaterNow = isQOrLaterNow
|
||||
this.addedManipulationFlags = addedManipulationFlags
|
||||
}
|
||||
|
||||
static parse = ({ protectionLevel, usageStats, notificationAccess, overlayPermission, accessibilityServiceEnabled, appVersion, didReboot, isQOrLaterNow }: SerializedUpdateDeviceStatusAction) => (
|
||||
static parse = ({
|
||||
protectionLevel,
|
||||
usageStats,
|
||||
notificationAccess,
|
||||
overlayPermission,
|
||||
accessibilityServiceEnabled,
|
||||
appVersion,
|
||||
didReboot,
|
||||
isQOrLaterNow,
|
||||
addedManipulationFlags
|
||||
}: SerializedUpdateDeviceStatusAction) => (
|
||||
new UpdateDeviceStatusAction({
|
||||
newProtetionLevel: protectionLevel,
|
||||
newUsageStatsPermissionStatus: usageStats,
|
||||
|
@ -81,7 +97,8 @@ export class UpdateDeviceStatusAction extends AppLogicAction {
|
|||
newAccessibilityServiceEnabled: accessibilityServiceEnabled,
|
||||
newAppVersion: appVersion,
|
||||
didReboot: !!didReboot,
|
||||
isQOrLaterNow: !!isQOrLaterNow
|
||||
isQOrLaterNow: !!isQOrLaterNow,
|
||||
addedManipulationFlags: addedManipulationFlags || 0
|
||||
})
|
||||
)
|
||||
}
|
||||
|
@ -96,4 +113,5 @@ export interface SerializedUpdateDeviceStatusAction {
|
|||
appVersion?: number
|
||||
didReboot?: boolean
|
||||
isQOrLaterNow?: boolean
|
||||
addedManipulationFlags?: number
|
||||
}
|
||||
|
|
|
@ -442,6 +442,9 @@ const definitions = {
|
|||
},
|
||||
"ignoreHadManipulationFlags": {
|
||||
"type": "number"
|
||||
},
|
||||
"ignoreManipulationFlags": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -1750,6 +1753,9 @@ const definitions = {
|
|||
},
|
||||
"isQOrLaterNow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"addedManipulationFlags": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -1907,6 +1913,9 @@ const definitions = {
|
|||
},
|
||||
"qOrLater": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mFlags": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -1931,6 +1940,7 @@ const definitions = {
|
|||
"hadManipulation",
|
||||
"hadManipulationFlags",
|
||||
"isUserKeptSignedIn",
|
||||
"mFlags",
|
||||
"model",
|
||||
"name",
|
||||
"networkTime",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -32,6 +32,11 @@ export const DeviceHadManipulationFlags = {
|
|||
ALL: 1 | 2 | 4 | 8 | 16 | 32
|
||||
}
|
||||
|
||||
export const DeviceManipulationFlags = {
|
||||
USED_FGS_KILLER: 1,
|
||||
ALL: 1
|
||||
}
|
||||
|
||||
export interface DeviceAttributesVersion1 {
|
||||
familyId: string
|
||||
deviceId: string
|
||||
|
@ -102,10 +107,15 @@ export interface DeviceAttributesVersion11 {
|
|||
hadManipulationFlags: number
|
||||
}
|
||||
|
||||
export interface DeviceAttributesVersion12 {
|
||||
manipulationFlags: number
|
||||
}
|
||||
|
||||
export type DeviceAttributes = DeviceAttributesVersion1 & DeviceAttributesVersion2 &
|
||||
DeviceAttributesVersion3 & DeviceAttributesVersion4 & DeviceAttributesVersion5 &
|
||||
DeviceAttributesVersion6 & DeviceAttributesVersion7 & DeviceAttributesVersion8 &
|
||||
DeviceAttributesVersion9 & DeviceAttributesVersion10 & DeviceAttributesVersion11
|
||||
DeviceAttributesVersion9 & DeviceAttributesVersion10 & DeviceAttributesVersion11 &
|
||||
DeviceAttributesVersion12
|
||||
|
||||
export type DeviceModel = Sequelize.Model<DeviceAttributes> & DeviceAttributes
|
||||
export type DeviceModelStatic = typeof Sequelize.Model & {
|
||||
|
@ -259,6 +269,18 @@ export const attributesVersion11: SequelizeAttributes<DeviceAttributesVersion11>
|
|||
}
|
||||
}
|
||||
|
||||
export const attributesVersion12: SequelizeAttributes<DeviceAttributesVersion12> = {
|
||||
manipulationFlags: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
validate: {
|
||||
min: 0,
|
||||
max: DeviceManipulationFlags.ALL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const attributes: SequelizeAttributes<DeviceAttributes> = {
|
||||
...attributesVersion1,
|
||||
...attributesVersion2,
|
||||
|
@ -270,7 +292,8 @@ export const attributes: SequelizeAttributes<DeviceAttributes> = {
|
|||
...attributesVersion8,
|
||||
...attributesVersion9,
|
||||
...attributesVersion10,
|
||||
...attributesVersion11
|
||||
...attributesVersion11,
|
||||
...attributesVersion12
|
||||
}
|
||||
|
||||
export const createDeviceModel = (sequelize: Sequelize.Sequelize): DeviceModelStatic => sequelize.define('Device', attributes) as DeviceModelStatic
|
||||
|
@ -291,7 +314,8 @@ export const hasDeviceManipulation = (device: DeviceAttributes) => {
|
|||
manipulationOfOverlayPermission ||
|
||||
manipulationOfAsPermission
|
||||
|
||||
const hasAnyManipulation = hasActiveManipulationWarning || device.hadManipulation
|
||||
const hasAnyManipulation = hasActiveManipulationWarning || device.hadManipulation ||
|
||||
device.manipulationFlags !== 0
|
||||
|
||||
return hasAnyManipulation
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { QueryInterface, Sequelize, Transaction } from 'sequelize'
|
||||
import { attributesVersion12 as deviceAttributes } from '../../device'
|
||||
|
||||
export async function up (queryInterface: QueryInterface, sequelize: Sequelize) {
|
||||
await sequelize.transaction({
|
||||
type: Transaction.TYPES.EXCLUSIVE
|
||||
}, async (transaction) => {
|
||||
await queryInterface.addColumn('Devices', 'manipulationFlags', {
|
||||
...deviceAttributes.manipulationFlags
|
||||
}, {
|
||||
transaction
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export async function down (queryInterface: QueryInterface, sequelize: Sequelize) {
|
||||
await sequelize.transaction({
|
||||
type: Transaction.TYPES.EXCLUSIVE
|
||||
}, async (transaction) => {
|
||||
await queryInterface.removeColumn('Devices', 'manipulationFlags', { transaction })
|
||||
})
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -63,5 +63,6 @@ export const prepareDeviceEntry = ({ familyId, userId, deviceAuthToken, deviceId
|
|||
asEnabled: false,
|
||||
wasAsEnabled: false,
|
||||
activityLevelBlocking: false,
|
||||
isQorLater: false
|
||||
isQorLater: false,
|
||||
manipulationFlags: 0
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
import { UpdateDeviceStatusAction } from '../../../../action'
|
||||
import { DeviceHadManipulationFlags, hasDeviceManipulation } from '../../../../database/device'
|
||||
import { DeviceHadManipulationFlags, DeviceManipulationFlags, hasDeviceManipulation } from '../../../../database/device'
|
||||
import { newPermissionStatusValues } from '../../../../model/newpermissionstatus'
|
||||
import { protetionLevels } from '../../../../model/protectionlevel'
|
||||
import { runtimePermissionStatusValues } from '../../../../model/runtimepermissionstatus'
|
||||
|
@ -155,6 +155,14 @@ export async function dispatchUpdateDeviceStatus ({ deviceId, action, cache }: {
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
const effectiveManipulationFlags = action.addedManipulationFlags & DeviceManipulationFlags.ALL
|
||||
|
||||
if (effectiveManipulationFlags !== 0) {
|
||||
deviceEntry.manipulationFlags = deviceEntry.manipulationFlags | effectiveManipulationFlags
|
||||
}
|
||||
}
|
||||
|
||||
await deviceEntry.save({ transaction: cache.transaction })
|
||||
|
||||
if (hasDeviceManipulation(deviceEntry)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -81,6 +81,10 @@ export async function dispatchIgnoreManipulation ({ action, cache }: {
|
|||
}
|
||||
}
|
||||
|
||||
if (action.ignoreManipulationFlags !== 0) {
|
||||
deviceEntry.manipulationFlags = deviceEntry.manipulationFlags & (~action.ignoreManipulationFlags)
|
||||
}
|
||||
|
||||
await deviceEntry.save({ transaction: cache.transaction })
|
||||
cache.invalidiateDeviceList = true
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -64,7 +64,8 @@ export async function getDeviceList ({ database, transaction, familyEntry }: {
|
|||
asEnabled: item.asEnabled,
|
||||
wasAsEnabled: item.wasAsEnabled,
|
||||
activityLevelBlocking: item.activityLevelBlocking,
|
||||
qOrLater: item.isQorLater
|
||||
qOrLater: item.isQorLater,
|
||||
mFlags: item.manipulationFlags
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ export interface ServerDeviceData {
|
|||
wasAsEnabled: boolean
|
||||
activityLevelBlocking: boolean
|
||||
qOrLater: boolean
|
||||
mFlags: number // manipulation flags
|
||||
}
|
||||
|
||||
export interface ServerUpdatedCategoryBaseData {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue