upgrade: modernização automatizada Logto_Supa

This commit is contained in:
2026-04-20 16:05:25 +00:00
parent ec1499e59c
commit d950384dad
7 changed files with 232 additions and 326 deletions

30
.env Normal file
View File

@@ -0,0 +1,30 @@
# --- LOGTO_SUPA UPGRADE ---
VITE_LOGTO_ENDPOINT=https://logto-bzlued1boxl3t8ewsyn99an9.187.77.227.172.sslip.io
VITE_LOGTO_APP_ID=3whpc0jru4ka5nerinnuc
VITE_LOGTO_ORG_ID=b8dvrye4978k
VITE_SUPABASE_SCHEMA=TSCUT
# --- LOGTO_SUPA UPGRADE ---
VITE_LOGTO_ENDPOINT=https://logto-bzlued1boxl3t8ewsyn99an9.187.77.227.172.sslip.io
VITE_LOGTO_APP_ID=3whpc0jru4ka5nerinnuc
VITE_LOGTO_ORG_ID=4j7uhxlmia9e
VITE_SUPABASE_SCHEMA=TSCUT
# --- LOGTO_SUPA UPGRADE ---
VITE_LOGTO_ENDPOINT=https://logto-bzlued1boxl3t8ewsyn99an9.187.77.227.172.sslip.io
VITE_LOGTO_APP_ID=3whpc0jru4ka5nerinnuc
VITE_LOGTO_ORG_ID=4j7uhxlmia9e
VITE_SUPABASE_SCHEMA=TSCUT
# --- LOGTO_SUPA UPGRADE ---
VITE_LOGTO_ENDPOINT=https://logto-bzlued1boxl3t8ewsyn99an9.187.77.227.172.sslip.io
VITE_LOGTO_APP_ID=3whpc0jru4ka5nerinnuc
VITE_LOGTO_ORG_ID=4j7uhxlmia9e
VITE_SUPABASE_SCHEMA=TSCUT
# --- LOGTO_SUPA UPGRADE ---
VITE_LOGTO_ENDPOINT=https://logto-bzlued1boxl3t8ewsyn99an9.187.77.227.172.sslip.io
VITE_LOGTO_APP_ID=3whpc0jru4ka5nerinnuc
VITE_LOGTO_ORG_ID=4j7uhxlmia9e
VITE_SUPABASE_SCHEMA=TSCUT

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

9
dist/index.html vendored
View File

@@ -4,17 +4,18 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:,"> <link rel="icon" href="/logo.png" type="image/png">
<title>Otimizador de Corte - TSCUT</title> <title>Otimizador de Corte - TSCUT</title>
<script type="module" crossorigin src="/assets/index-IF645QI4.js"></script> <script type="module" crossorigin src="/assets/index-DH8nqnYc.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CB6i2Hq1.css"> <link rel="stylesheet" crossorigin href="/assets/index-CpYIvPGq.css">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<header> <header>
<h1>📊 Otimizador de Plano de Corte</h1> <h1><img src="/logo.png" alt="Logo" class="app-logo">Otimizador de Plano de Corte</h1>
<p>Barras Lineares | Algoritmo FFD Avançado | Otimização com Múltiplas Barras</p> <p>Barras Lineares | Algoritmo FFD Avançado | Otimização com Múltiplas Barras</p>
<button id="themeToggle" class="theme-toggle-btn" onclick="toggleTheme()" title="Alternar Tema">🌙</button>
</header> </header>
<div class="layout"> <div class="layout">

151
package-lock.json generated
View File

@@ -9,8 +9,10 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@logto/browser": "^3.0.13",
"@logto/react": "^4.0.14",
"papaparse": "^5.5.3", "papaparse": "^5.5.3",
"vite": "^7.2.6", "vite": "^7.3.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
} }
}, },
@@ -430,6 +432,52 @@
"node": ">=18" "node": ">=18"
} }
}, },
"node_modules/@logto/browser": {
"version": "3.0.13",
"resolved": "https://registry.npmjs.org/@logto/browser/-/browser-3.0.13.tgz",
"integrity": "sha512-SlZ76XiVh2es6eFB1M+ldV6b60eC3+eeKoRQ8/AvOlpwHhrY/v2FPw5LOd/vZ+WYjzDqsxNtOMdhTdliHZ7V1g==",
"license": "MIT",
"dependencies": {
"@logto/client": "^3.1.8",
"@silverhand/essentials": "^2.9.3",
"js-base64": "^3.7.4"
}
},
"node_modules/@logto/client": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/@logto/client/-/client-3.1.8.tgz",
"integrity": "sha512-f6NcPOV/K1IpPm4ccARWeYpQVMeN4mfikGg+5Qw1rcIPYPUpD5BmDsQbVTAnDepCMbC7syzRerZmbwL8S3UL+A==",
"license": "MIT",
"dependencies": {
"@logto/js": "^6.1.2",
"@silverhand/essentials": "^2.9.3",
"camelcase-keys": "^9.1.3",
"jose": "^5.2.2"
}
},
"node_modules/@logto/js": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/@logto/js/-/js-6.1.2.tgz",
"integrity": "sha512-YB/TfixPGI0Spbs8LXiKuASOKFUE9VmlTkXiPfgg3UXQsIPTU71KjKxEXZRePu3xdPNhsZ6WtnRfRvvcpP+KGQ==",
"license": "MIT",
"dependencies": {
"@silverhand/essentials": "^2.9.3",
"camelcase-keys": "^9.1.3"
}
},
"node_modules/@logto/react": {
"version": "4.0.14",
"resolved": "https://registry.npmjs.org/@logto/react/-/react-4.0.14.tgz",
"integrity": "sha512-hSZSwxdsLkQjcqsLRH+rvMUkchh1cB+niXOfbvafILJUgmN0YWVZ6QAeyV/wmUteNb5iB463Fnboz10MUXi04A==",
"license": "MIT",
"dependencies": {
"@logto/browser": "^3.0.13",
"@silverhand/essentials": "^2.9.3"
},
"peerDependencies": {
"react": ">=16.8.0"
}
},
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.59.0", "version": "4.59.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz",
@@ -755,6 +803,16 @@
"win32" "win32"
] ]
}, },
"node_modules/@silverhand/essentials": {
"version": "2.9.3",
"resolved": "https://registry.npmjs.org/@silverhand/essentials/-/essentials-2.9.3.tgz",
"integrity": "sha512-OM9pyGc/yYJMVQw+fFOZZaTHXDWc45sprj+ky+QjC9inhf5w51L1WBmzAwFuYkHAwO1M19fxVf2sTH9KKP48yg==",
"license": "MIT",
"engines": {
"node": ">=18.12.0",
"pnpm": "^10.0.0"
}
},
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
@@ -770,6 +828,36 @@
"node": ">=0.8" "node": ">=0.8"
} }
}, },
"node_modules/camelcase": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz",
"integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==",
"license": "MIT",
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/camelcase-keys": {
"version": "9.1.3",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-9.1.3.tgz",
"integrity": "sha512-Rircqi9ch8AnZscQcsA1C47NFdaO3wukpmIRzYcDOrmvgt78hM/sj5pZhZNec2NM12uk5vTwRHZ4anGcrC4ZTg==",
"license": "MIT",
"dependencies": {
"camelcase": "^8.0.0",
"map-obj": "5.0.0",
"quick-lru": "^6.1.1",
"type-fest": "^4.3.2"
},
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cfb": { "node_modules/cfb": {
"version": "1.2.2", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
@@ -885,6 +973,33 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0" "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
} }
}, },
"node_modules/jose": {
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz",
"integrity": "sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/panva"
}
},
"node_modules/js-base64": {
"version": "3.7.8",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.8.tgz",
"integrity": "sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow==",
"license": "BSD-3-Clause"
},
"node_modules/map-obj": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-5.0.0.tgz",
"integrity": "sha512-2L3MIgJynYrZ3TYMriLDLWocz15okFakV6J12HXvMXDHui2x/zgChzg1u9mFFGbbGWE+GsLpQByt4POb9Or+uA==",
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.11", "version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
@@ -955,6 +1070,28 @@
"node": "^10 || ^12 || >=14" "node": "^10 || ^12 || >=14"
} }
}, },
"node_modules/quick-lru": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.2.tgz",
"integrity": "sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/react": {
"version": "19.2.5",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.5.tgz",
"integrity": "sha512-llUJLzz1zTUBrskt2pwZgLq59AemifIftw4aB7JxOqf1HY2FDaGDxgwpAPVzHU1kdWabH7FauP4i1oEeer2WCA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.59.0", "version": "4.59.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz",
@@ -1036,6 +1173,18 @@
"url": "https://github.com/sponsors/SuperchupuDev" "url": "https://github.com/sponsors/SuperchupuDev"
} }
}, },
"node_modules/type-fest": {
"version": "4.41.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz",
"integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==",
"license": "(MIT OR CC0-1.0)",
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/vite": { "node_modules/vite": {
"version": "7.3.1", "version": "7.3.1",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz",

View File

@@ -18,8 +18,10 @@
"license": "ISC", "license": "ISC",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@logto/browser": "^3.0.13",
"@logto/react": "^4.0.14",
"papaparse": "^5.5.3", "papaparse": "^5.5.3",
"vite": "^7.3.1", "vite": "^7.3.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
} }
} }

View File

@@ -1,3 +1,47 @@
// --- LOGTO AUTH GUARD ---
import LogtoClient from '@logto/browser';
// Escondemos o app imediatamente
const style = document.createElement('style');
style.innerHTML = 'body { display: none !important; }';
document.head.appendChild(style);
const logtoClient = new LogtoClient({
endpoint: import.meta.env.VITE_LOGTO_ENDPOINT,
appId: import.meta.env.VITE_LOGTO_APP_ID,
resource: 'https://default.logto.app/api',
scopes: ['openid', 'offline_access', 'profile', 'email', 'organizations'],
});
async function protectPage() {
const isCallback = window.location.pathname.includes('callback');
if (isCallback) {
try {
await logtoClient.handleSignInCallback(window.location.href);
window.location.assign('/');
} catch (error) {
console.error('Falha no callback do Logto:', error);
}
return;
}
const isAuthenticated = await logtoClient.isAuthenticated();
if (!isAuthenticated) {
await logtoClient.signIn(window.location.origin);
return;
}
// Se chegou aqui, está logado. Mostramos o app.
style.remove();
console.log('TSCUT: Acesso autorizado.');
}
// Execução imediata
protectPage();
// -------------------------
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import Papa from 'papaparse'; import Papa from 'papaparse';
import './style.css'; import './style.css';