/* * server component for the TimeLimit App * Copyright (C) 2019 - 2020 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 . */ import { SerializedAppActivityItem } from '../model/appactivity' import { SerializedInstalledApp } from '../model/installedapp' import { NewPermissionStatus } from '../model/newpermissionstatus' import { ProtectionLevel } from '../model/protectionlevel' import { RuntimePermissionStatus } from '../model/runtimepermissionstatus' export interface ServerDataStatus { devices?: ServerDeviceList // newDeviceList apps?: Array // newInstalledApps rmCategories?: Array // removedCategories categoryBase?: Array // newCategoryBaseData categoryApp?: Array // newCategoryAssignedApps usedTimes?: Array // newCategoryUsedTimes rules?: Array // newOrUpdatedTimeLimitRules users?: ServerUserList // newUserList fullVersion: number // fullVersionUntil message?: string } export interface ServerDeviceList { version: string data: Array } export interface ServerUserList { version: string data: Array } export interface ServerUserEntry { id: string name: string password: string secondPasswordSalt: string type: 'parent' | 'child' timeZone: string disableLimitsUntil: number mail: string currentDevice: string categoryForNotAssignedApps: string relaxPrimaryDevice: boolean mailNotificationFlags: number blockedTimes: string } export interface ServerDeviceData { deviceId: string name: string model: string addedAt: number currentUserId: string networkTime: 'disabled' | 'if possible' | 'enabled' cProtectionLevel: ProtectionLevel hProtectionLevel: ProtectionLevel cUsageStats: RuntimePermissionStatus hUsageStats: RuntimePermissionStatus cNotificationAccess: NewPermissionStatus hNotificationAccess: NewPermissionStatus cAppVersion: number hAppVersion: number tDisablingAdmin: boolean reboot: boolean hadManipulation: boolean hadManipulationFlags: number reportUninstall: boolean isUserKeptSignedIn: boolean showDeviceConnected: boolean defUser: string defUserTimeout: number rebootIsManipulation: boolean cOverlay: RuntimePermissionStatus hOverlay: RuntimePermissionStatus asEnabled: boolean wasAsEnabled: boolean activityLevelBlocking: boolean qOrLater: boolean } export interface ServerUpdatedCategoryBaseData { categoryId: string childId: string title: string blockedTimes: string // blockedMinutesInWeek extraTime: number extraTimeDay: number tempBlocked: boolean tempBlockTime: number version: string parentCategoryId: string blockAllNotifications: boolean timeWarnings: number // mbl = minimum battery level mblCharging: number mblMobile: number sort: number } export interface ServerUpdatedCategoryAssignedApps { categoryId: string apps: Array version: string } export interface ServerUpdatedCategoryUsedTimes { categoryId: string times: Array version: string } export interface ServerUsedTimeItem { day: number // day of epoch time: number // in milliseconds } export interface ServerUpdatedTimeLimitRules { categoryId: string version: string rules: Array } export interface ServerTimeLimitRule { id: string extraTime: boolean // applyToExtraTimeUsage dayMask: number // as binary bitmask maxTime: number // maximumTimeInMillis } export interface ServerInstalledAppsData { deviceId: string version: string apps: Array activities: Array }