@@ -24,8 +24,6 @@ export default function VersionAlert() {
24
24
const [ isAlertVisible , setIsAlertVisible ] = useState ( true ) ;
25
25
const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
26
26
const [ isChangeLogOpen , setIsChangeLogOpen ] = useState ( false ) ;
27
- const [ changelog , setChangelog ] = useState ( null ) ;
28
- const [ isLoading , setIsLoading ] = useState ( true ) ;
29
27
30
28
useEffect ( ( ) => {
31
29
setMounted ( true ) ;
@@ -89,7 +87,6 @@ export default function VersionAlert() {
89
87
90
88
const handleDismiss = ( ) => {
91
89
try {
92
- // Save dismissal time and version to localStorage
93
90
localStorage . setItem (
94
91
"versionAlertDismissed" ,
95
92
JSON . stringify ( {
@@ -160,66 +157,94 @@ export default function VersionAlert() {
160
157
< DialogTitle > Update Instructions</ DialogTitle >
161
158
</ DialogHeader >
162
159
< div className = "space-y-6" >
163
- < div >
164
- < p className = "mb-8" >
165
- In the same directory you originally deployed from:
160
+ { /* Option 1: Automatic Update */ }
161
+ < div className = "space-y-4 border rounded-lg p-4" >
162
+ < h3 className = "text-lg font-semibold" >
163
+ Option 1: Automatic Update (Linux/MacOS only)
164
+ </ h3 >
165
+ < p className = "text-sm" >
166
+ In the same directory you originally deployed from, run these
167
+ commands to download and execute the automatic update script:
166
168
</ p >
167
- < p className = "mb-2" >
168
- 1. Get the migrations.sql file to update your database schema:
169
- </ p >
170
- < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm" >
169
+ < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm mb-2" >
171
170
curl -O
172
- https://raw.githubusercontent.com/algertc/ALPR-Database/main/migrations.sql
171
+ https://raw.githubusercontent.com/algertc/ALPR-Database/refs/heads/ main/update.sh
173
172
</ div >
174
- < p className = "mt-1 text-sm text-muted-foreground" >
175
- This file should be in the same directory as your
176
- docker-compose.yml file. Alternatively, you can
177
- < a
178
- href = "https://github.com/algertc/ALPR-Database/blob/main/migrations.sql"
179
- target = "_blank"
180
- rel = "noopener noreferrer"
181
- className = "text-blue-600 hover:text-blue-800 ml-1"
182
- >
183
- download it manually from GitHub
184
- </ a >
185
- .
173
+ < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm mb-2" >
174
+ chmod +x update.sh
175
+ </ div >
176
+ < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm" >
177
+ ./update.sh
178
+ </ div >
179
+ < p className = "text-sm text-muted-foreground" >
180
+ Follow the on-screen instructions after running the update
181
+ script.
186
182
</ p >
187
183
</ div >
188
184
189
- < div >
190
- < p className = "mb-2" >
191
- 2. Check for updates to the
192
- < a
193
- href = "https://github.com/algertc/ALPR-Database/blob/main/docker-compose.yml"
194
- target = "_blank"
195
- rel = "noopener noreferrer"
196
- className = "text-blue-600 hover:text-blue-800 ml-1"
197
- >
198
- docker-compose.yml
199
- </ a >
200
- { " " }
201
- file on GitHub. Ensure your file is up-to-date with the latest
202
- version.
203
- </ p >
204
- </ div >
185
+ { /* Option 2: Manual Update */ }
186
+ < div className = "space-y-4 border rounded-lg p-4" >
187
+ < h3 className = "text-lg font-semibold" > Option 2: Manual Update</ h3 >
188
+ < div >
189
+ < p className = "text-sm" >
190
+ In the same directory you originally deployed from:
191
+ </ p >
192
+ < p className = "mb-2" >
193
+ 1. Get the migrations.sql file to update your database schema:
194
+ </ p >
195
+ < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm" >
196
+ curl -O
197
+ https://raw.githubusercontent.com/algertc/ALPR-Database/main/migrations.sql
198
+ </ div >
199
+ < p className = "mt-1 text-sm text-muted-foreground" >
200
+ This file should be in the same directory as your
201
+ docker-compose.yml file. Alternatively, you can
202
+ < a
203
+ href = "https://github.com/algertc/ALPR-Database/blob/main/migrations.sql"
204
+ target = "_blank"
205
+ rel = "noopener noreferrer"
206
+ className = "text-blue-600 hover:text-blue-800 ml-1"
207
+ >
208
+ download it manually from GitHub
209
+ </ a >
210
+ .
211
+ </ p >
212
+ </ div >
205
213
206
- < div >
214
+ < div >
215
+ < p className = "mb-2" >
216
+ 2. Check for updates to the
217
+ < a
218
+ href = "https://github.com/algertc/ALPR-Database/blob/main/docker-compose.yml"
219
+ target = "_blank"
220
+ rel = "noopener noreferrer"
221
+ className = "text-blue-600 hover:text-blue-800 ml-1"
222
+ >
223
+ docker-compose.yml
224
+ </ a >
225
+ { " " }
226
+ file on GitHub. Ensure your file is up-to-date with the latest
227
+ version.
228
+ </ p >
229
+ </ div >
207
230
< p className = "mb-2" >
208
- 2. Restart the application with the latest version:
231
+ 3. Create the a directory called "storage" in the same location
232
+ as your auth and config directories.
209
233
</ p >
210
- < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm mb-2" >
211
- docker compose pull
212
- </ div >
213
- < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm" >
214
- docker compose up -d
234
+ < div >
235
+ < p className = "mb-2" >
236
+ 4. Restart the application with the latest version:
237
+ </ p >
238
+ < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm mb-2" >
239
+ docker compose pull
240
+ </ div >
241
+ < div className = "bg-slate-950 dark:bg-neutral-800 text-slate-50 p-3 rounded-md font-mono text-sm" >
242
+ docker compose up -d
243
+ </ div >
215
244
</ div >
216
- < p className = "mt-1 text-sm text-muted-foreground" >
217
- Run these commands in the directory containing your
218
- docker-compose.yml file.
219
- </ p >
220
245
</ div >
221
246
222
- < p className = "text-sm text-muted-foreground mt-4 " >
247
+ < p className = "text-sm text-muted-foreground mt-2 " >
223
248
Note: Your existing data will be preserved during the update.
224
249
</ p >
225
250
</ div >
@@ -232,36 +257,38 @@ export default function VersionAlert() {
232
257
< DialogTitle > Changelog</ DialogTitle >
233
258
</ DialogHeader >
234
259
< ScrollArea className = "h-[60vh] pr-4" >
235
- { ! versionInfo ? .changelog ? (
260
+ { ! versionInfo || ! versionInfo . changelog ? (
236
261
< div className = "flex items-center justify-center h-full" >
237
262
< p className = "text-muted-foreground" > No changelog available</ p >
238
263
</ div >
239
264
) : (
240
265
< div className = "space-y-6" >
241
- { versionInfo . changelog . map ( ( version ) => (
242
- < div key = { version . version } className = "space-y-2" >
243
- < div className = "flex items-center gap-2" >
244
- < h3 className = "text-lg font-semibold" >
245
- Version { version . version }
246
- </ h3 >
247
- { version . version === versionInfo . current && (
248
- < Badge variant = "outline" className = "text-xs" >
249
- Current
250
- </ Badge >
251
- ) }
266
+ { Array . isArray ( versionInfo . changelog ) &&
267
+ versionInfo . changelog . map ( ( version ) => (
268
+ < div key = { version . version } className = "space-y-2" >
269
+ < div className = "flex items-center gap-2" >
270
+ < h3 className = "text-lg font-semibold" >
271
+ Version { version . version }
272
+ </ h3 >
273
+ { version . version === versionInfo . current && (
274
+ < Badge variant = "outline" className = "text-xs" >
275
+ Current
276
+ </ Badge >
277
+ ) }
278
+ </ div >
279
+ < p className = "text-sm text-muted-foreground" >
280
+ { version . date }
281
+ </ p >
282
+ < ul className = "space-y-1 list-disc list-inside" >
283
+ { version . changes &&
284
+ version . changes . map ( ( change , index ) => (
285
+ < li key = { index } className = "text-sm" >
286
+ { change }
287
+ </ li >
288
+ ) ) }
289
+ </ ul >
252
290
</ div >
253
- < p className = "text-sm text-muted-foreground" >
254
- { version . date }
255
- </ p >
256
- < ul className = "space-y-1 list-disc list-inside" >
257
- { version . changes . map ( ( change , index ) => (
258
- < li key = { index } className = "text-sm" >
259
- { change }
260
- </ li >
261
- ) ) }
262
- </ ul >
263
- </ div >
264
- ) ) }
291
+ ) ) }
265
292
</ div >
266
293
) }
267
294
</ ScrollArea >
0 commit comments