Update error message
Update the error message displayed during sign-up.
This commit is contained in:
@@ -8,7 +8,20 @@ export const getSupabaseUrl = () => {
|
||||
const useProxy = localStorage.getItem('use_cors_proxy') === 'true';
|
||||
const proxyType = localStorage.getItem('proxy_type') || 'cloudflare';
|
||||
|
||||
if (useProxy) {
|
||||
// HTTP URL 사용 시 자동으로 프록시 활성화
|
||||
const isHttpUrl = storedUrl.startsWith('http:') && !storedUrl.startsWith('http://localhost');
|
||||
if (isHttpUrl && !useProxy) {
|
||||
// 자동으로 프록시 설정 (Cloudflare)
|
||||
localStorage.setItem('use_cors_proxy', 'true');
|
||||
localStorage.setItem('proxy_type', 'cloudflare');
|
||||
console.log('HTTP URL 감지: CORS 프록시 자동 활성화 (Cloudflare)');
|
||||
}
|
||||
|
||||
// 프록시 사용 여부 재확인 (자동 활성화 후)
|
||||
const shouldUseProxy = localStorage.getItem('use_cors_proxy') === 'true';
|
||||
const currentProxyType = localStorage.getItem('proxy_type') || 'cloudflare';
|
||||
|
||||
if (shouldUseProxy) {
|
||||
// URL에 이미 프로토콜이 포함되어 있는지 확인
|
||||
const cleanUrl = storedUrl.trim();
|
||||
const hasProtocol = cleanUrl.startsWith('http://') || cleanUrl.startsWith('https://');
|
||||
@@ -17,7 +30,7 @@ export const getSupabaseUrl = () => {
|
||||
// 선택된 프록시 타입에 따라 URL 생성
|
||||
let proxyUrl = '';
|
||||
|
||||
switch (proxyType) {
|
||||
switch (currentProxyType) {
|
||||
case 'corsproxy.io':
|
||||
// 주의: 쿼리 파라미터가 포함된 URL에서 발생하는 문제를 해결하기 위해
|
||||
// 전체 URL을 인코딩하고 끝에 슬래시 추가
|
||||
@@ -72,6 +85,21 @@ export const getSupabaseKey = () => {
|
||||
// CORS 프록시 사용 여부 설정
|
||||
export const useCorsProxy = (enabled: boolean) => {
|
||||
localStorage.setItem('use_cors_proxy', enabled.toString());
|
||||
|
||||
// HTTP URL 사용 시 프록시 비활성화 방지
|
||||
if (!enabled) {
|
||||
const storedUrl = localStorage.getItem('supabase_url');
|
||||
const isHttpUrl = storedUrl && storedUrl.startsWith('http:') && !storedUrl.startsWith('http://localhost');
|
||||
|
||||
if (isHttpUrl) {
|
||||
// HTTP URL에서는 프록시를 강제로 유지
|
||||
localStorage.setItem('use_cors_proxy', 'true');
|
||||
console.warn('경고: HTTP URL 사용 시 CORS 프록시를 비활성화할 수 없습니다. 프록시가 자동으로 유지됩니다.');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return enabled;
|
||||
};
|
||||
|
||||
// CORS 프록시 유형 설정
|
||||
@@ -86,6 +114,16 @@ export const getProxyType = () => {
|
||||
|
||||
// CORS 프록시 사용 여부 확인
|
||||
export const isCorsProxyEnabled = () => {
|
||||
// HTTP URL 사용 시 자동으로 프록시 활성화
|
||||
const storedUrl = localStorage.getItem('supabase_url');
|
||||
const isHttpUrl = storedUrl && storedUrl.startsWith('http:') && !storedUrl.startsWith('http://localhost');
|
||||
|
||||
if (isHttpUrl) {
|
||||
// HTTP URL에서는 프록시 자동 활성화
|
||||
localStorage.setItem('use_cors_proxy', 'true');
|
||||
return true;
|
||||
}
|
||||
|
||||
return localStorage.getItem('use_cors_proxy') === 'true';
|
||||
};
|
||||
|
||||
@@ -99,10 +137,12 @@ export const configureSupabase = (url: string, key: string, useProxy: boolean =
|
||||
? cleanUrl
|
||||
: `http://${cleanUrl}`;
|
||||
|
||||
// HTTP URL을 사용하고 프록시가 활성화되지 않은 경우 경고
|
||||
// HTTP URL을 사용하고 프록시가 활성화되지 않은 경우 자동 활성화
|
||||
const isHttpUrl = normalizedUrl.startsWith('http:') && !normalizedUrl.startsWith('http://localhost');
|
||||
if (isHttpUrl && !useProxy) {
|
||||
console.warn('경고: HTTP URL을 사용하면서 CORS 프록시가 비활성화되어 있습니다. 브라우저에서 접근 문제가 발생할 수 있습니다.');
|
||||
console.warn('경고: HTTP URL 감지, CORS 프록시 자동 활성화');
|
||||
useProxy = true;
|
||||
proxyType = 'cloudflare';
|
||||
}
|
||||
|
||||
// 로컬 스토리지에 설정 저장
|
||||
|
||||
Reference in New Issue
Block a user