@lars_hagemann/mediaserver-frontend-plugin-types 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -0
- package/package.json +61 -0
- package/types/plugin.d.ts +10012 -0
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Mediaserver Frontend
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
The recommended way to use this software is using Docker:
|
|
6
|
+
|
|
7
|
+
```yml
|
|
8
|
+
services:
|
|
9
|
+
server:
|
|
10
|
+
image: treelabmediaserver/mediaserver-backend:stable
|
|
11
|
+
depends_on:
|
|
12
|
+
postgres:
|
|
13
|
+
condition: service_healthy
|
|
14
|
+
redis:
|
|
15
|
+
condition: service_healthy
|
|
16
|
+
restart: always
|
|
17
|
+
environment:
|
|
18
|
+
POSTGRES_HOST: postgres
|
|
19
|
+
REDIS_HOST: redis
|
|
20
|
+
DOCUMENT_STORE_CONFIG_PATH: /config.json
|
|
21
|
+
volumes:
|
|
22
|
+
- /my-partition:/store-0
|
|
23
|
+
- /tmp:/tmp
|
|
24
|
+
- ./documentStoreConfig.json:/config.json
|
|
25
|
+
ports:
|
|
26
|
+
- ${BACKEND_PORT}:${BACKEND_PORT}
|
|
27
|
+
- ${WEBSOCKET_PORT}:${WEBSOCKET_PORT}
|
|
28
|
+
healthcheck:
|
|
29
|
+
test: ["CMD", "curl", "-f", "http://localhost:${BACKEND_PORT}/health"]
|
|
30
|
+
interval: 30s
|
|
31
|
+
timeout: 5s
|
|
32
|
+
retries: 3
|
|
33
|
+
|
|
34
|
+
postgres:
|
|
35
|
+
image: postgres:16
|
|
36
|
+
healthcheck:
|
|
37
|
+
test: ["CMD", "pg_isready", "-U", "dev"]
|
|
38
|
+
interval: 5s
|
|
39
|
+
timeout: 5s
|
|
40
|
+
retries: 5
|
|
41
|
+
restart: always
|
|
42
|
+
volumes:
|
|
43
|
+
- postgres_data:/var/lib/postgresql/data
|
|
44
|
+
|
|
45
|
+
redis:
|
|
46
|
+
image: redis:latest
|
|
47
|
+
healthcheck:
|
|
48
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
49
|
+
interval: 5s
|
|
50
|
+
timeout: 5s
|
|
51
|
+
retries: 5
|
|
52
|
+
restart: always
|
|
53
|
+
volumes:
|
|
54
|
+
- redis_data:/data
|
|
55
|
+
|
|
56
|
+
frontend:
|
|
57
|
+
image: treelabmediaserver/mediaserver-web:stable
|
|
58
|
+
depends_on:
|
|
59
|
+
server:
|
|
60
|
+
condition: service_healthy
|
|
61
|
+
restart: always
|
|
62
|
+
environment:
|
|
63
|
+
MEDIASERVER_BACKEND_URL: "http://${BACKEND_URL}:${BACKEND_PORT}"
|
|
64
|
+
MEDIASERVER_WEBSOCKET_URL: "ws://${BACKEND_URL}:${WEBSOCKET_PORT}"
|
|
65
|
+
ports:
|
|
66
|
+
- 80:80
|
|
67
|
+
|
|
68
|
+
volumes:
|
|
69
|
+
postgres_data:
|
|
70
|
+
redis_data:
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
with a corresponding `.env` file
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
BACKEND_URL=<your-url>
|
|
77
|
+
BACKEND_PORT=8080
|
|
78
|
+
WEBSOCKET_PORT=8081
|
|
79
|
+
|
|
80
|
+
POSTGRES_PORT=5432
|
|
81
|
+
POSTGRES_DB=mediaserver
|
|
82
|
+
POSTGRES_USER=<your-user>
|
|
83
|
+
POSTGRES_PASSWORD=<your-password>
|
|
84
|
+
|
|
85
|
+
REDIS_ENDPOINT=redis
|
|
86
|
+
REDIS_PORT=6379
|
|
87
|
+
REDIS_USERNAME=<your-user>
|
|
88
|
+
REDIS_PASSWORD=<your-password>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Translations
|
|
92
|
+
|
|
93
|
+
You can install additional installations by creating a custom `manifest.json` and copying your translation into the container.
|
|
94
|
+
|
|
95
|
+
```yml
|
|
96
|
+
services:
|
|
97
|
+
frontend:
|
|
98
|
+
image: treelabmediaserver/mediaserver-web
|
|
99
|
+
volumes:
|
|
100
|
+
- ./manifest.json:/var/www/html/manifest.json
|
|
101
|
+
- ./fr.json:/var/www/html/translations/fr.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Your manifest could look like this:
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"plugins": [],
|
|
108
|
+
"translations": [
|
|
109
|
+
{
|
|
110
|
+
"lang": "fr",
|
|
111
|
+
"path": "/translations/fr.json",
|
|
112
|
+
"name": "French",
|
|
113
|
+
"localName": "Français",
|
|
114
|
+
"flag": "🇫🇷"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"lang": "it",
|
|
118
|
+
"path": "https://some-cdn.net/mediaserver/it.json",
|
|
119
|
+
"name": "Italian",
|
|
120
|
+
"localName": "Italiano",
|
|
121
|
+
"flag": "🇮🇹"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
I am not going to support other languages other than english and german out of the box, since I cannot maintain other languages and I don't want some locales to be in a broken state.
|
|
128
|
+
|
|
129
|
+
## Plugins
|
|
130
|
+
|
|
131
|
+
Installing plugins works similar to installing language extensions. You need to update your manifest.json and copy the plugin JS file into your docker container:
|
|
132
|
+
|
|
133
|
+
```yml
|
|
134
|
+
services:
|
|
135
|
+
frontend:
|
|
136
|
+
image: treelabmediaserver/mediaserver-web
|
|
137
|
+
volumes:
|
|
138
|
+
- ./manifest.json:/var/www/html/manifest.json
|
|
139
|
+
- ./fr.json:/var/www/html/translations/fr.json
|
|
140
|
+
- ./csvPlugin.js:/var/www/html/plugins/csvPlugin.js
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Your manifest could look like this:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"plugins": [
|
|
148
|
+
{
|
|
149
|
+
"name": "csv-plugin",
|
|
150
|
+
"url": "/plugins/csvPlugin.js",
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "plain-plugin",
|
|
154
|
+
"url": "https://some-cdn.net/mediaserver/plainPlugin.js",
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"translations": [
|
|
158
|
+
{
|
|
159
|
+
"lang": "fr",
|
|
160
|
+
"path": "/translations/fr.json",
|
|
161
|
+
"name": "French",
|
|
162
|
+
"localName": "Français",
|
|
163
|
+
"flag": "🇫🇷"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Developing plugins
|
|
170
|
+
|
|
171
|
+
Plugins need to export a default object that implements the `FileTypePlugin` interface. The `csvPlugin.js` plugin could look like this:
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
const csvPlugin = {
|
|
175
|
+
matcher: (type) => type === "text/csv",
|
|
176
|
+
icon: (icons) => icons.FaFileCsv,
|
|
177
|
+
Render: (context) => (
|
|
178
|
+
// ...
|
|
179
|
+
),
|
|
180
|
+
Diashow: (context) => {
|
|
181
|
+
// ...
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default csvPlugin;
|
|
186
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lars_hagemann/mediaserver-frontend-plugin-types",
|
|
3
|
+
"version": "0.24.1",
|
|
4
|
+
"files": [
|
|
5
|
+
"types",
|
|
6
|
+
"README.md"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"types": "types/plugin.d.ts",
|
|
10
|
+
"repository": {
|
|
11
|
+
"url": "https://github.com/LarsHagemann/mediaserver"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "vite --host 0.0.0.0",
|
|
15
|
+
"build": "tsc -b && vite build",
|
|
16
|
+
"preview": "vite preview --host 0.0.0.0",
|
|
17
|
+
"lint:check": "eslint .",
|
|
18
|
+
"lint:fix": "eslint . --fix",
|
|
19
|
+
"style:check": "prettier --check src/**/*.ts",
|
|
20
|
+
"style:fix": "prettier --write src/**/*.ts",
|
|
21
|
+
"types:plugins": "tsc -p tsconfig.plugin.json",
|
|
22
|
+
"prepare": "npm run types:plugins"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@lars_hagemann/tags": "^1.0.4",
|
|
26
|
+
"@reduxjs/toolkit": "^2.9.2",
|
|
27
|
+
"@tailwindcss/vite": "^4.1.12",
|
|
28
|
+
"luxon": "^3.7.2",
|
|
29
|
+
"react": "^19.1.1",
|
|
30
|
+
"react-dom": "^19.1.1",
|
|
31
|
+
"react-i18next": "^15.7.3",
|
|
32
|
+
"react-icons": "^5.5.0",
|
|
33
|
+
"react-paginate": "^8.3.0",
|
|
34
|
+
"react-redux": "^9.2.0",
|
|
35
|
+
"react-router": "^7.8.2",
|
|
36
|
+
"react-use-websocket": "^4.13.0",
|
|
37
|
+
"redux-persist": "^6.0.0",
|
|
38
|
+
"tailwind-merge": "^3.3.1",
|
|
39
|
+
"tailwindcss": "^4.1.12",
|
|
40
|
+
"zod": "^4.1.5"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@microsoft/api-extractor": "^7.53.3",
|
|
44
|
+
"@types/luxon": "^3.7.1",
|
|
45
|
+
"@types/react": "^19.1.10",
|
|
46
|
+
"@types/react-dom": "^19.1.7",
|
|
47
|
+
"@types/react-paginate": "^7.1.4",
|
|
48
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
49
|
+
"eslint": "^9.33.0",
|
|
50
|
+
"eslint-plugin-react": "^7.37.5",
|
|
51
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
52
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
53
|
+
"globals": "^16.3.0",
|
|
54
|
+
"prettier": "^3.6.2",
|
|
55
|
+
"sass-embedded": "^1.91.0",
|
|
56
|
+
"typescript": "~5.8.3",
|
|
57
|
+
"typescript-eslint": "^8.39.1",
|
|
58
|
+
"unplugin-dts": "^1.0.0-beta.0",
|
|
59
|
+
"vite": "^7.1.2"
|
|
60
|
+
}
|
|
61
|
+
}
|