Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit e2816ff

Browse files
committed
Readme update
1 parent 8690cc5 commit e2816ff

File tree

5 files changed

+77
-14
lines changed

5 files changed

+77
-14
lines changed

Diff for: README.md

+68-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
1-
> Under development!
2-
31
# TaskTimeTerminate-SyncServer
2+
> A docker image providing a sync-server for TaskTimeTerminate
3+
4+
## Features
5+
- Server Task
6+
- Add Tasks directly on the server
7+
- Statistics
8+
- Show stats one the server
9+
- Show charts made with ChartJS
10+
- Account Management
11+
- Each user gets an account, also called group
12+
- This account can have
13+
- Device Management
14+
15+
## Install on server
16+
This is a docker project, so it you will need docker to run it.
17+
It is recommended to use the [docker-compose.yml](https://github.com/KIMB-technologies/TaskTimeTerminateServer/blob/master/docker-compose.yml) provided.
18+
19+
1. Copy the [docker-compose.yml](https://github.com/KIMB-technologies/TaskTimeTerminateServer/blob/master/docker-compose.yml)
20+
2. Make sure to bind to a free port
21+
3. Change the volume to a location wich is regularly made a backup from. (Inside the container all data is stored in `/php-code/data/`)
22+
4. Edit environment variables
23+
- `DEVMODE` should always be `false` (enables error messages)
24+
- `CONF_DOMAIN` the url where the service will be hosted (what the webbrowser sees)
25+
- `CONF_TIMEZONE` a PHP timezone string, matching the location of the server users (see https://www.php.net/manual/en/timezones.php for list of supported ones)
26+
- `ADMIN_ACCOUNT` username/ groupname of the initial account (will be created on first container startup; will be an admin user)
27+
- `ADMIN_PASSWORD` password for the initial account
28+
5. Run the container and log into the Webinterface
29+
30+
> One may delete `ADMIN_ACCOUNT` and `ADMIN_PASSWORD` after the account is created (and also change the password),
31+
> If `ADMIN_ACCOUNT` is set and the account already exists, the system will overwrite the password with `ADMIN_PASSWORD`.
32+
33+
## Setup TTT-Client
34+
### TTT-Client
35+
> See https://github.com/KIMB-technologies/TaskTimeTerminate for more information about TTT.
36+
37+
1. Log into the Webinterface and go to `Device Management`
38+
2. Add a new device and remember its token.
39+
3. Run `ttt conf sync server` in your client
40+
4. Type the URL of this installation, the account name/ group, the client token and the devices/ clients name.
41+
5. The client will import all recorded data to the installation and also update it with new completed task.
42+
43+
## Im & Export
44+
This repository contains a script to import data from other devices to the server
45+
and also a script that exports the data of all devices to a directory.
46+
The format used is the same as used in the local directory synchronisation.
47+
48+
So one may transfer the the data from an old client (not used anymore, used clients will
49+
automatically import their data when they are connected to the server for the first time)
50+
to the server.
51+
52+
### Import to Server
53+
Create the the device for which the data should be imported and
54+
remember its token. (The name of the device can only be set via the Webinterface).
55+
56+
1. Open `./imexport/import.php`
57+
2. Fill in `Server URL, Account Name, Device Name, Device Token` between `APIClient( ... );` as stated in the file
58+
3. Change the `$sourcePath`, it has to be the directory containing the devices data (e.g. `2020-04-01.json`, `2020-04-03.json`, ...)
59+
4. Set the timezone `date_default_timezone_set( 'Europe/Berlin' );` (see https://www.php.net/manual/en/timezones.php for list of supported ones)
60+
4. Run `php ./imexport/import.php`
61+
5. The data for the device will be available in the Webinterface (and through the API).
62+
63+
### Export from Server
64+
One may use any device of an account.
465

5-
A docker image providing a sync-server for TaskTimeTerminate
66+
1. Open `./imexport/export.php`
67+
2. Fill in `Server URL, Account Name, Device Name, Device Token` between `APIClient( ... );` as stated in the file
68+
3. One may change the `$destPath`, it has to be any empty directory (or it will be created).
69+
4. Run `php ./imexport/export.php`
70+
5. The data for all devices will show up in `$destPath`

Diff for: imexport/export.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* LOGIN
99
*/
1010
$client = new APIClient(
11-
"http://localhost:8080/",
12-
"admin",
13-
"test",
14-
"YvCSpXLZxpT0RPLI4yg6JIhSBKwILJ1vFqNILvf6luji7JrtUS"
11+
"http://localhost:8080/", // Server URL
12+
"admin", // Account/ Group Name
13+
"test", // Device Name
14+
"YvCSpXLZxpT0RPLI4yg6JIhSBKwILJ1vFqNILvf6luji7JrtUS" // Device Token
1515
);
1616
/**
1717
* SETTINGS

Diff for: imexport/import.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* LOGIN
99
*/
1010
$client = new APIClient(
11-
"http://localhost:8080/", // ADD API URL
11+
"http://localhost:8080/", // Server URL
1212
"admin", // API Username/ Group
1313
"test", // API Device name
1414
"9iTOiAj0nMnN0yxZvYf2bnt9vSlCPKKBb7U0f8chkcLnVCQPe3" // Token for device

Diff for: php/core/AddEdit.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AddEdit {
2020
public function __construct( Template $temp, Login $login ) {
2121
$this->login = $login;
2222
$this->temp = $temp;
23-
$this->serverDir = API::getStorageDir($this->login->getGroup(), 'server');
23+
$this->serverDir = API::getStorageDir($this->login->getGroup(), 'Server');
2424

2525
if( $_SERVER['REQUEST_METHOD'] === 'POST' ){
2626
$this->addNew();
@@ -38,7 +38,7 @@ private function viewDay(string $file) : void {
3838
$this->temp->setContent('NOTEMSG','Invalid format for day!');
3939
return;
4040
}
41-
$r = new JSONReader(API::getStorageDir($this->login->getGroup(), 'server', true) . substr($file, 0, -5));
41+
$r = new JSONReader(API::getStorageDir($this->login->getGroup(), 'Server', true) . substr($file, 0, -5));
4242

4343
// delete one?
4444
if( isset( $_GET['delete'] ) && is_numeric($_GET['delete']) ){
@@ -65,7 +65,7 @@ private function viewDay(string $file) : void {
6565

6666
if(empty($r->getArray())){
6767
$r->__destruct();
68-
JSONReader::deleteFile(API::getStorageDir($this->login->getGroup(), 'server', true) . substr($file, 0, -5));
68+
JSONReader::deleteFile(API::getStorageDir($this->login->getGroup(), 'Server', true) . substr($file, 0, -5));
6969
}
7070
}
7171

@@ -104,7 +104,7 @@ private function addNew() : void {
104104
);
105105

106106
if($this->initDir()){
107-
$r = new JSONReader(API::getStorageDir($this->login->getGroup(), 'server', true) . date('Y-m-d', $begin));
107+
$r = new JSONReader(API::getStorageDir($this->login->getGroup(), 'Server', true) . date('Y-m-d', $begin));
108108
if($r->setValue([null], $task)){
109109
$this->temp->setContent('NOTEMSG','Added task.');
110110
return;

Diff for: php/core/Utilities.php

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
class Utilities {
1818

19-
const VERSION = 'v0.0.0a';
20-
2119
/**
2220
* Possible chars for:
2321
*/

0 commit comments

Comments
 (0)