feat: media API (video/bbox/thumbnail), UUID unification, dot matrix text, portal fixes, API dictionary V1.3

This commit is contained in:
Warren
2026-05-06 13:34:49 +08:00
parent e75c4d6f07
commit 74b6182eba
197 changed files with 17511 additions and 8759 deletions
+29 -37
View File
@@ -60,13 +60,14 @@
<div class="space-y-2 text-xs font-mono">
<div class="bg-gray-900 p-2 rounded">
<span class="text-green-400"># Login</span>
<pre class="text-gray-300 whitespace-pre-wrap">curl -X POST http://127.0.0.1:3003/api/v1/auth/login \
<pre class="text-gray-300 whitespace-pre-wrap">curl -X POST {{ baseUrl }}/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"demo","password":"demo"}'</pre>
</div>
<div class="bg-gray-900 p-2 rounded">
<span class="text-red-400"># Logout</span>
<pre class="text-gray-300">curl -X POST http://127.0.0.1:3003/api/v1/auth/logout</pre>
<pre class="text-gray-300">curl -X POST {{ baseUrl }}/api/v1/auth/logout \
-H "X-API-Key: YOUR_API_KEY"</pre>
</div>
</div>
</div>
@@ -75,8 +76,9 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { httpFetch, getCurrentConfig, saveConfig } from '@/api/client'
const username = ref('')
const password = ref('')
@@ -85,50 +87,40 @@ const loading = ref(false)
const showPassword = ref(false)
const router = useRouter()
const baseUrl = computed(() => getCurrentConfig().api_base_url)
const handleLogin = async () => {
error.value = ''
loading.value = true
try {
const response = await fetch('http://127.0.0.1:3003/api/v1/auth/login', {
const config = getCurrentConfig()
const data = await httpFetch<{
success: boolean
message?: string
api_key: string
user: Record<string, any>
}>(`${config.api_base_url}/api/v1/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: username.value,
password: password.value
})
});
body: JSON.stringify({ username: username.value, password: password.value })
})
if (response.ok) {
const data = await response.json();
if (data.success) {
// Save User Info
localStorage.setItem('momentry_user', JSON.stringify(data.user));
// Save API Key
localStorage.setItem('momentry_api_key', data.api_key);
// Update Config
const config = {
api_base_url: 'http://127.0.0.1:3003',
api_key: data.api_key,
timeout_secs: 30,
};
localStorage.setItem('portal_config', JSON.stringify(config));
router.push('/home');
} else {
error.value = data.message || 'Login failed';
}
} else if (response.status === 401) {
error.value = 'Invalid username or password';
if (data.success) {
localStorage.setItem('momentry_user', JSON.stringify(data.user))
localStorage.setItem('momentry_api_key', data.api_key)
saveConfig({ ...config, api_key: data.api_key })
router.push('/home')
} else {
error.value = 'Server error';
error.value = data.message || 'Login failed'
}
} catch (e: any) {
if (e.message?.includes('401')) {
error.value = 'Invalid username or password'
} else {
error.value = 'Connection error. Is the server running?'
}
} catch (e) {
error.value = 'Connection error. Is the server running?';
} finally {
loading.value = false;
loading.value = false
}
}
</script>