Fix production web API routing
This commit is contained in:
+6
-1
@@ -2,10 +2,15 @@
|
||||
|
||||
## Versión actual
|
||||
|
||||
- Versión base: `1.2.2`
|
||||
- Versión base: `1.2.3`
|
||||
|
||||
## Historial
|
||||
|
||||
### 1.2.3 - 2026-04-23
|
||||
|
||||
- La web fuerza uso de `/api` y `/api/downloads/android-apk` cuando corre en `sign.linkedcorp.net`, evitando compilar enlaces de producción con IPs de desarrollo.
|
||||
- Se corrigen referencias heredadas del servidor `192.168.222.72` hacia `192.168.222.40` en configuraciones y documentación de desarrollo.
|
||||
|
||||
### 1.2.2 - 2026-04-23
|
||||
|
||||
- Android vuelve a ofrecer activar huella después del login siempre que el acceso biométrico no esté activo.
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ android/
|
||||
Por defecto la app apunta a:
|
||||
|
||||
```text
|
||||
http://192.168.222.72:4000
|
||||
http://192.168.222.40:4000
|
||||
```
|
||||
|
||||
Ese valor está en:
|
||||
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
applicationId "net.linkedcorp.linkedsign"
|
||||
minSdk 26
|
||||
targetSdk 35
|
||||
versionCode 10202
|
||||
versionName "1.2.2"
|
||||
versionCode 10203
|
||||
versionName "1.2.3"
|
||||
|
||||
buildConfigField "String", "API_BASE_URL", "\"${apiBaseUrl}\""
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ Valor actual:
|
||||
{
|
||||
"expo": {
|
||||
"extra": {
|
||||
"apiBaseUrl": "http://192.168.222.72:4000"
|
||||
"apiBaseUrl": "http://192.168.222.40:4000"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"package": "net.linkedcorp.linkedsign"
|
||||
},
|
||||
"extra": {
|
||||
"apiBaseUrl": "http://192.168.222.72:4000"
|
||||
"apiBaseUrl": "http://192.168.222.40:4000"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ const extra = Constants.expoConfig?.extra || {};
|
||||
export const API_BASE_URL =
|
||||
process.env.EXPO_PUBLIC_API_BASE_URL ||
|
||||
extra.apiBaseUrl ||
|
||||
'http://192.168.222.72:4000';
|
||||
'http://192.168.222.40:4000';
|
||||
|
||||
+7
-7
@@ -33,8 +33,8 @@ Variables importantes:
|
||||
|
||||
```env
|
||||
PORT=4000
|
||||
CORS_ORIGIN=http://192.168.222.72:5173
|
||||
FRONTEND_URL=http://192.168.222.72:5173
|
||||
CORS_ORIGIN=http://192.168.222.40:5173
|
||||
FRONTEND_URL=http://192.168.222.40:5173
|
||||
MAIL_HOST=
|
||||
MAIL_PORT=587
|
||||
MAIL_SECURE=false
|
||||
@@ -73,7 +73,7 @@ DB_NAME=
|
||||
Registra usuario y envía correo de validación.
|
||||
|
||||
```bash
|
||||
curl -X POST http://192.168.222.72:4000/auth/register \
|
||||
curl -X POST http://192.168.222.40:4000/auth/register \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email": "usuario@correo.com",
|
||||
@@ -86,7 +86,7 @@ curl -X POST http://192.168.222.72:4000/auth/register \
|
||||
Inicia sesión. Si el correo no está validado, reenvía el enlace.
|
||||
|
||||
```bash
|
||||
curl -X POST http://192.168.222.72:4000/auth/login \
|
||||
curl -X POST http://192.168.222.40:4000/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email": "usuario@correo.com",
|
||||
@@ -117,7 +117,7 @@ Devuelve usuario autenticado y preferencias visuales de firma.
|
||||
Sube un PDF original.
|
||||
|
||||
```bash
|
||||
curl -X POST http://192.168.222.72:4000/documents \
|
||||
curl -X POST http://192.168.222.40:4000/documents \
|
||||
-H "Authorization: Bearer TU_ACCESS_TOKEN" \
|
||||
-F "file=@/ruta/documento.pdf"
|
||||
```
|
||||
@@ -137,7 +137,7 @@ Descarga un documento original.
|
||||
Sube un certificado `.p12` o `.pfx`.
|
||||
|
||||
```bash
|
||||
curl -X POST http://192.168.222.72:4000/certificates \
|
||||
curl -X POST http://192.168.222.40:4000/certificates \
|
||||
-H "Authorization: Bearer TU_ACCESS_TOKEN" \
|
||||
-F "file=@/ruta/certificado.p12" \
|
||||
-F "alias=MPGH 2026" \
|
||||
@@ -155,7 +155,7 @@ Lista certificados del usuario, incluyendo datos de cadena embebida.
|
||||
Firma un documento con un certificado del usuario.
|
||||
|
||||
```bash
|
||||
curl -X POST http://192.168.222.72:4000/signatures/sign \
|
||||
curl -X POST http://192.168.222.40:4000/signatures/sign \
|
||||
-H "Authorization: Bearer TU_ACCESS_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "linkedsign-backend",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"private": true,
|
||||
"description": "Initial backend for LinkedSign",
|
||||
"main": "src/server.js",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -5,8 +5,9 @@ import {
|
||||
getAccessToken,
|
||||
setAccessToken,
|
||||
} from '../utils/session';
|
||||
import { resolveApiUrl } from '../config/api';
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:4000';
|
||||
const API_URL = resolveApiUrl();
|
||||
|
||||
const client = axios.create({
|
||||
baseURL: API_URL,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from 'axios';
|
||||
import { resolveApiUrl } from '../config/api';
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:4000';
|
||||
const API_URL = resolveApiUrl();
|
||||
|
||||
export const verifySignature = (code) => axios.get(`${API_URL}/signatures/verify/${code}`);
|
||||
export const getLegalTemplates = () => axios.get(`${API_URL}/legal/templates`);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
const normalize = (value) => String(value || '').replace(/\/$/, '');
|
||||
|
||||
export const resolveApiUrl = () => {
|
||||
if (typeof window !== 'undefined' && window.location?.hostname === 'sign.linkedcorp.net') {
|
||||
return '/api';
|
||||
}
|
||||
|
||||
return normalize(import.meta.env.VITE_API_URL || 'http://192.168.222.40:4000');
|
||||
};
|
||||
|
||||
export const resolveAndroidApkUrl = () => {
|
||||
if (typeof window !== 'undefined' && window.location?.hostname === 'sign.linkedcorp.net') {
|
||||
return '/api/downloads/android-apk';
|
||||
}
|
||||
|
||||
return `${resolveApiUrl()}/downloads/android-apk`;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import { useAuth } from '../../contexts/AuthContext';
|
||||
import { Download, PenTool } from 'lucide-react';
|
||||
import toast from 'react-hot-toast';
|
||||
import { SESSION_EXPIRED_MESSAGE, translateApiError } from '../../utils/session';
|
||||
import { resolveAndroidApkUrl } from '../../config/api';
|
||||
import packageInfo from '../../../package.json';
|
||||
|
||||
export default function LoginPage() {
|
||||
@@ -12,8 +13,7 @@ export default function LoginPage() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [form, setForm] = useState({ email: '', password: '' });
|
||||
const [loading, setLoading] = useState(false);
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_URL || 'http://localhost:4000').replace(/\/$/, '');
|
||||
const androidApkUrl = `${apiBaseUrl}/downloads/android-apk`;
|
||||
const androidApkUrl = resolveAndroidApkUrl();
|
||||
const showAndroidDownload = useMemo(() => {
|
||||
if (typeof navigator === 'undefined') return false;
|
||||
return /Android/i.test(navigator.userAgent || '');
|
||||
|
||||
Reference in New Issue
Block a user