Skip to content

Commit 885d606

Browse files
authored
Merge pull request #572 from arabcoders/dev
Dev
2 parents 4cfab8b + 0da1945 commit 885d606

File tree

99 files changed

+1959
-1894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1959
-1894
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
strategy:
3838
fail-fast: true
3939
matrix:
40-
php: [ 8.3 ]
40+
php: [ 8.4 ]
4141
steps:
4242
- name: Checkout
4343
uses: actions/checkout@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/.env
44
/.phpunit.result.cache
55
/.vscode
6+
/frontend/exported/

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ COPY --from=composer:2 /usr/bin/composer /opt/bin/composer
1111
LABEL maintainer="[email protected]"
1212

1313
ARG TZ=UTC
14-
ARG PHP_V=php83
14+
ARG PHP_V=php84
1515
ARG PHP_PACKAGES="common ctype curl dom fileinfo fpm intl mbstring opcache pcntl pdo_sqlite phar posix session shmop simplexml snmp sockets sodium sysvmsg sysvsem sysvshm tokenizer xml openssl xmlreader xmlwriter zip pecl-igbinary pecl-xhprof pecl-redis"
1616
ARG TOOL_PATH=/opt/app
1717
ARG USER_ID=1000

FAQ.md

+46-29
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ Click `Save Changes`
516516
>
517517
> If you use multiple plex servers and use the same PlexPass account for all of them, You have to add each backend
518518
> using the same method above, while enabling `limit webhook events to` `selected user` and `backend unique id`.
519-
> Essentially, this method replaced the old unified webhook.token for backends.
519+
> Essentially, this method replaced the old unified webhook token for backends.
520520
521521
-----
522522

@@ -625,45 +625,37 @@ https://watchstate.example.org {
625625

626626
### WS_API_AUTO
627627

628-
The purpose of this environment variable is to automate the configuration process. It's mainly used for people who uses
629-
many browsers
630-
to access the `WebUI` and want to automate the configuration process. as it's requires the API settings to be configured
631-
before it
632-
can be used. This environment variable can be enabled by setting `WS_API_AUTO=true` in `${WS_DATA_PATH}/config/.env`.
628+
The purpose of this environment variable is to automate the configuration process. It's mainly used for people who use
629+
many browsers to access the `WebUI` and want to automate the configuration process. as it's requires the API settings to
630+
be configured before it can be used. This environment variable can be enabled by setting `WS_API_AUTO=true` in
631+
`${WS_DATA_PATH}/config/.env`.
633632

634633
#### Why you should use it?
635634

636635
You normally should not use it, as it's a **GREAT SECURITY RISK**. However, if you are using the tool in a secure
637-
environment
638-
and not worried about exposing your API key, you can use it to automate the configuration process.
636+
environment and not worried about exposing your API key, you can use it to automate the configuration process.
639637

640638
#### Why you should not use it?
641639

642640
Because, by exposing your API key, you are also exposing every data you have in the tool. This is a **GREAT SECURITY
643-
RISK**,
644-
any person or bot that are able to access the `WebUI` will also be able to visit `/v1/api/system/auto` and get your API
645-
key. And with this key
646-
they can do anything they want with your data. including viewing your media servers api keys.
647-
648-
So, please while we have this option available, we strongly recommend not to use it if `WatchState` is exposed to the
649-
internet.
641+
RISK**, any person or bot that are able to access the `WebUI` will also be able to visit `/v1/api/system/auto` and get
642+
your API key. And with this key they can do anything they want with your data. including viewing your media servers API
643+
keys. So, please while we have this option available, we strongly recommend not to use it if `WatchState` is exposed to
644+
the internet.
650645

651646
> [!IMPORTANT]
652647
> This environment variable is **GREAT SECURITY RISK**, and we strongly recommend not to use it if `WatchState` is
653-
> exposed to the internet.
654-
> I cannot stress this enough, please do not use it unless you are in a secure environment.
648+
> exposed to the internet. I cannot stress this enough, please do not use it unless you are in a secure environment.
655649
656650
---
657651

658652
### How to disable the included cache server and use external cache server?
659653

660654
Set this environment variable in your `compose.yaml` file `DISABLE_CACHE` with value of `1`. to use external redis
661-
server
662-
you need to alter the value of `WS_CACHE_URL` environment variable. the format for this variable
663-
is `redis://host:port?password=auth&db=db_num`,
664-
for example to use redis from another container you could use something
665-
like `redis://172.23.1.10:6379?password=my_secert_password&db=8`.
666-
We only support `redis` and API compatible alternative.
655+
server you need to alter the value of `WS_CACHE_URL` environment variable. the format for this variable is
656+
`redis://host:port?password=auth&db=db_num`, for example to use redis from another container you could use something
657+
like `redis://172.23.1.10:6379?password=my_secert_password&db=8`. We only support `redis` and API compatible
658+
alternative.
667659

668660
Once that done, restart the container.
669661

@@ -784,14 +776,14 @@ their server, You can follow these steps.
784776

785777
#### Requirements
786778

787-
* [PHP 8.3](http://https://www.php.net/downloads.php) with both the `CLI` and `fpm` mode.
779+
* [PHP 8.4](http://https://www.php.net/downloads.php) with both the `CLI` and `fpm` mode.
788780
* PHP Extensions `pdo`, `pdo-sqlite`, `mbstring`, `json`, `ctype`, `curl`, `redis`, `sodium` and `simplexml`.
789781
* [Composer](https://getcomposer.org/download/) for dependency management.
790782
* [Redis-server](https://redis.io/) for caching or a compatible implementation that works
791783
with [php-redis](https://github.com/phpredis/phpredis).
792784
* [Caddy](https://caddyserver.com/) for frontend handling. However, you can use whatever you like. As long as it has
793785
support for fastcgi.
794-
* [nodejs v20+](https://nodejs.org/en/download/) for `WebUI` compilation.
786+
* [Node.js v20+](https://nodejs.org/en/download/) for `WebUI` compilation.
795787

796788
#### Installation
797789

@@ -903,7 +895,7 @@ and treat them as not found.
903895
This helps with slow stat calls in network shares, or cloud storage.
904896

905897
Everytime we do a stat call we cache it for 1 hour, so if we have multiple records reporting the same path, we only do
906-
the stat check once.
898+
the stat check once. Assuming all your media backends are using same path for the media files.
907899

908900
---
909901

@@ -957,7 +949,8 @@ Note: the tip about adding the group_add came from the user `binarypancakes` in
957949
### Advanced: How to extend the GUID parser to support more GUIDs or custom ones?
958950

959951
By going to `More > Custom GUIDs` in the WebUI, you can add custom GUIDs to the parser. We know not all people,
960-
like using GUI, as such You can extend the parser by creating new file at `/config/config/guid.yaml` with the following content.
952+
like using GUI, as such You can extend the parser by creating new file at `/config/config/guid.yaml` with the following
953+
content.
961954

962955
```yaml
963956
# (Optional) The version of the guid file. If omitted, it will default to the latest version.
@@ -1018,8 +1011,32 @@ As you can see from the config, it's roughly how we expected it to be. The `guid
10181011
custom GUIDs. the `links` array is where you map from client/backends GUIDs to the custom GUID in `WatchState`.
10191012

10201013
Everything in this file should be in lower case. If error occurs, the tool will log a warning and ignore the guid,
1021-
By default, we only show `ERROR` levels in log file, You can lower it by setting `WS_LOGGER_FILE_LEVEL` environment variable
1014+
By default, we only show `ERROR` levels in log file, You can lower it by setting `WS_LOGGER_FILE_LEVEL` environment
1015+
variable
10221016
to `WARNING`.
10231017

1024-
If you added or removed a guid from the `guid.yaml` file, you should run `system:index --force-reindex` command to update the
1018+
If you added or removed a guid from the `guid.yaml` file, you should run `system:index --force-reindex` command to
1019+
update the
10251020
database indexes with the new guids.
1021+
1022+
---
1023+
1024+
### Sync watch progress.
1025+
1026+
In order to sync the watch progress between media backends, you need to enable the following environment variable
1027+
`WS_SYNC_PROGRESS` in `(WebUI) > Env` page or via the cli using the following command:
1028+
1029+
```bash
1030+
$ docker exec -ti watchstate console system:env -k WS_SYNC_PROGRESS -e true
1031+
```
1032+
1033+
For best experience, you should enable the `Webhooks` feature for the media backends you want to sync the watch
1034+
progress,
1035+
however, if you are unable to do so, the `Tasks > import` task will also generate progress watch events. However, it's
1036+
not as reliable as the `Webhooks` or as fast. using `Webhooks` is the recommended way and offers the best experience.
1037+
1038+
To check if there is any watch progress events being registered, You can go to `(WebUI) > More > Events` and check
1039+
`on_progress` events, if you are seeing those, this means the progress is being synced. Check the `Tasks logs` to see
1040+
the event log.
1041+
1042+

NEWS.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Old Updates
22

3+
### 2024-09-14
4+
5+
We have recently added support for extending WatchState with more GUIDs, as of now, the support for it is done via
6+
editing a`/config/guid.yaml` file in the config directory. We plan to hopefully add management via WebUI in near the
7+
future. For more information please check out the associated
8+
FAQ entry about it at [this link](FAQ.md#advanced-how-to-extend-the-guid-parser-to-support-more-guids-or-custom-ones).
9+
10+
The mapping should work for all officially supported clients. If you have a client that is not supported, you have to
11+
manually add support for that client,
12+
or request the maintainer to add support for it.
13+
314
### 2024-08-19
415

516
We have migrated the `state:push` task into the new events system, as such the old task `state:push` is now gone.

README.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ out of the box, this tool support `Jellyfin`, `Plex` and `Emby` media servers.
99

1010
## Updates
1111

12-
### 2024-10-07
12+
### 2024-12-30
1313

14-
We have added a WebUI page for Custom GUIDs and stabilized on `v1.0` for the `guid.yaml` file spec. We strongly recommend
15-
to use the `WebUI` to manage the GUIDs, as it's much easier to use than editing the `guid.yaml` file directly. and both the
16-
`WebUI` and `API` have safeguards to prevent you from breaking the parser. For more information please check out the associated
17-
FAQ entry about it at [this link](FAQ.md#advanced-how-to-extend-the-guid-parser-to-support-more-guids-or-custom-ones).
14+
We have removed the old environment variables `WS_CRON_PROGRESS` and `WS_CRON_PUSH` in favor of the new ones
15+
`WS_SYNC_PROGRESS` and `WS_PUSH_ENABLED`. please update your environment variables accordingly. We have also added
16+
new FAQ entry about watch progress syncing via [this link](FAQ.md#sync-watch-progress).
1817

19-
### 2024-09-14
18+
### 2024-10-07
2019

21-
We have recently added support for extending WatchState with more GUIDs, as of now, the support for it is done via
22-
editing a`/config/guid.yaml` file in the config directory. We plan to hopefully add management via WebUI in near the future. For more information please check out the associated
20+
We have added a WebUI page for Custom GUIDs and stabilized on `v1.0` for the `guid.yaml` file spec. We strongly
21+
recommend
22+
to use the `WebUI` to manage the GUIDs, as it's much easier to use than editing the `guid.yaml` file directly. and both
23+
the
24+
`WebUI` and `API` have safeguards to prevent you from breaking the parser. For more information please check out the
25+
associated
2326
FAQ entry about it at [this link](FAQ.md#advanced-how-to-extend-the-guid-parser-to-support-more-guids-or-custom-ones).
2427

25-
The mapping should work for all officially supported clients. If you have a client that is not supported, you have to manually add support for that client,
26-
or request the maintainer to add support for it.
27-
2828
---
2929
Refer to [NEWS](NEWS.md) for old updates.
3030

@@ -38,7 +38,8 @@ Refer to [NEWS](NEWS.md) for old updates.
3838
* Search your backend for `title` or `item id`.
3939
* Display and filter your play state. Can be exported as `yaml` or `json`.
4040
* Check if your media servers reporting same data via the parity command.
41-
* Track your watch progress via webhooks.
41+
* Sync your watch progress via webhooks or scheduled tasks.
42+
* Check if your media backends have stale references to old files.
4243

4344
----
4445

@@ -115,7 +116,7 @@ You can check the message in the notification itself to know what went wrong. Or
115116
error has been logged to a file named `app.YYYYMMDD.log`.
116117

117118
If everything went ok, you should see the backend shows up in the same page. You can then go to the Tasks page and click
118-
on `Qeueu Task`, for first time import we recommand letting
119+
on `Queue Task`, for first time import we recommend letting
119120
the task run in the background, as it might take a while to import all the data.
120121

121122
Once you have done all for your backends, You should go back again to `Tasks` page and enable the `Import` and `Export`
@@ -134,7 +135,7 @@ After starting the container you should start adding your backends and to do so
134135
> [!NOTE]
135136
> to get your plex token, please
136137
> visit [this plex page](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/) to
137-
> know how to extract your plex token. For jellyfin & emby. Go to Dashboard > Advanced > API keys > then create new api
138+
> know how to extract your plex token. For jellyfin & emby. Go to Dashboard > Advanced > API keys > then create new API
138139
> keys.
139140

140141
```bash

bin/console

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
5151
require __DIR__ . '/../vendor/autoload.php';
5252

5353
try {
54-
$app = (new App\Libs\Initializer())->boot();
54+
$app = new App\Libs\Initializer()->boot();
5555
} catch (Throwable $e) {
5656
$message = strtr(
5757
'CLI: Exception [{kind}] was thrown unhandled during CLI boot context. Error [{message} @ {file}:{line}].',

composer.json

+28-24
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test": "vendor/bin/phpunit"
1515
},
1616
"require": {
17-
"php": "^8.3",
17+
"php": "^8.4",
1818
"ext-pdo": "*",
1919
"ext-pdo_sqlite": "*",
2020
"ext-mbstring": "*",
@@ -26,34 +26,36 @@
2626
"ext-redis": "*",
2727
"ext-posix": "*",
2828
"ext-openssl": "*",
29-
"monolog/monolog": "^3.4",
30-
"symfony/console": "^6.1.4",
31-
"symfony/cache": "^6.1.3",
32-
"symfony/yaml": "^6.1.4",
33-
"symfony/process": "^6.1.3",
34-
"symfony/http-client": "^6.1.4",
35-
"symfony/lock": "^6.1.3",
36-
"league/container": "^4.2",
37-
"psr/http-client": "^1.0.1",
38-
"psr/simple-cache": "3.0 as 1.0",
39-
"psr/http-server-middleware": "^1.0.1",
40-
"nyholm/psr7": "^1.5.1",
41-
"nyholm/psr7-server": "^1.0.2",
42-
"dragonmantank/cron-expression": "^3.3.2",
43-
"halaxa/json-machine": "^1.1.1",
44-
"league/route": "^5.1.2",
45-
"psy/psysh": "^0.11.22",
46-
"symfony/event-dispatcher": "^6.1.4",
47-
"ramsey/uuid": "^4.5.1"
29+
"psr/http-client": "^1.0.3",
30+
"psr/simple-cache": "^3.0",
31+
"psr/http-server-middleware": "^1.0.2",
32+
"monolog/monolog": "^3.8.1",
33+
"symfony/console": "^7.2.1",
34+
"symfony/cache": "^7.2.1",
35+
"symfony/yaml": "^7.2",
36+
"symfony/process": "^7.2",
37+
"symfony/http-client": "^7.2.1",
38+
"symfony/lock": "^7.2",
39+
"symfony/event-dispatcher": "^7.2",
40+
"league/container": "^4.2.4",
41+
"league/route": "^6.2.0",
42+
"nyholm/psr7": "^1.8.2",
43+
"nyholm/psr7-server": "^1.1.0",
44+
"dragonmantank/cron-expression": "^3.4.0",
45+
"halaxa/json-machine": "^1.2.0",
46+
"psy/psysh": "^0.12.7",
47+
"ramsey/uuid": "^4.7.6"
4848
},
4949
"suggest": {
50-
"ext-sockets": "For UDP commincations."
50+
"ext-sockets": "For UDP communications."
5151
},
5252
"require-dev": {
5353
"roave/security-advisories": "dev-latest",
54-
"symfony/var-dumper": "^6.1.3",
55-
"perftools/php-profiler": "^1.1.1",
56-
"phpunit/phpunit": "^9.5.24"
54+
"symfony/var-dumper": "^7.2",
55+
"perftools/php-profiler": "^1.1.2",
56+
"phpunit/phpunit": "^11.5.2",
57+
"phpstan/phpstan": "^2.0",
58+
"psalm/phar": "^5.26"
5759
},
5860
"autoload-dev": {
5961
"psr-4": {
@@ -80,6 +82,8 @@
8082
"symfony/polyfill-php82": "*",
8183
"symfony/polyfill-php83": "*",
8284
"symfony/polyfill-php84": "*",
85+
"symfony/polyfill-php85": "*",
86+
"symfony/polyfill-php86": "*",
8387
"symfony/polyfill-ctype": "*",
8488
"symfony/polyfill-mbstring": "*",
8589
"symfony/polyfill-intl-normalizer": "*",

0 commit comments

Comments
 (0)