@riligar/elysia-backup 1.3.0 → 1.4.0
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/package.json +4 -4
- package/src/assets/favicon.ico +0 -0
- package/src/assets/logo.png +0 -0
- package/src/core/config.js +70 -0
- package/src/core/scheduler.js +99 -0
- package/src/core/session.js +90 -0
- package/src/index.js +609 -3
- package/src/middleware/auth.middleware.js +41 -0
- package/src/services/backup.service.js +169 -0
- package/src/services/s3-client.js +28 -0
- package/src/views/DashboardPage.js +56 -0
- package/src/views/LoginPage.js +23 -0
- package/src/views/components/ActionArea.js +48 -0
- package/src/views/components/FilesTab.js +111 -0
- package/src/views/components/Head.js +43 -0
- package/src/views/components/Header.js +54 -0
- package/src/views/components/LoginCard.js +114 -0
- package/src/views/components/SecuritySection.js +166 -0
- package/src/views/components/SettingsTab.js +88 -0
- package/src/views/components/StatusCards.js +54 -0
- package/src/views/scripts/backupApp.js +324 -0
- package/src/views/scripts/loginApp.js +60 -0
- package/src/elysia-backup.js +0 -1736
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alpine.js login app logic
|
|
3
|
+
* @param {{ totpEnabled: boolean }} props
|
|
4
|
+
* @returns {string} JavaScript code string
|
|
5
|
+
*/
|
|
6
|
+
export const loginAppScript = ({ totpEnabled }) => `
|
|
7
|
+
<script>
|
|
8
|
+
document.addEventListener('alpine:init', () => {
|
|
9
|
+
Alpine.data('loginApp', () => ({
|
|
10
|
+
username: '',
|
|
11
|
+
password: '',
|
|
12
|
+
totpCode: '',
|
|
13
|
+
totpEnabled: ${totpEnabled},
|
|
14
|
+
loading: false,
|
|
15
|
+
error: '',
|
|
16
|
+
|
|
17
|
+
init() {
|
|
18
|
+
this.$nextTick(() => lucide.createIcons());
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
async login() {
|
|
22
|
+
this.loading = true;
|
|
23
|
+
this.error = '';
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const payload = {
|
|
27
|
+
username: this.username,
|
|
28
|
+
password: this.password
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (this.totpEnabled && this.totpCode) {
|
|
32
|
+
payload.totpCode = this.totpCode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const response = await fetch('/backup/auth/login', {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
headers: { 'Content-Type': 'application/json' },
|
|
38
|
+
body: JSON.stringify(payload)
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const data = await response.json();
|
|
42
|
+
|
|
43
|
+
if (response.ok && data.status === 'success') {
|
|
44
|
+
window.location.href = '/backup';
|
|
45
|
+
} else {
|
|
46
|
+
this.error = data.message || 'Invalid credentials';
|
|
47
|
+
this.$nextTick(() => lucide.createIcons());
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
this.error = 'Connection failed. Please try again.';
|
|
51
|
+
this.$nextTick(() => lucide.createIcons());
|
|
52
|
+
} finally {
|
|
53
|
+
this.loading = false;
|
|
54
|
+
this.$nextTick(() => lucide.createIcons());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
`
|