Spaces:
Running
Running
Update index.html
Browse files- index.html +48 -0
index.html
CHANGED
@@ -1065,5 +1065,53 @@
|
|
1065 |
['a', 'b', 'c'].forEach(tranche => calculateTrancheOffer(tranche));
|
1066 |
});
|
1067 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1068 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/ccremic-vbeta1-07" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
1069 |
</html>
|
|
|
1065 |
['a', 'b', 'c'].forEach(tranche => calculateTrancheOffer(tranche));
|
1066 |
});
|
1067 |
</script>
|
1068 |
+
<Script>
|
1069 |
+
export default {
|
1070 |
+
async fetch(request, env, ctx) {
|
1071 |
+
const url = new URL(request.url);
|
1072 |
+
|
1073 |
+
// This is where you define the CORS headers
|
1074 |
+
const corsHeaders = {
|
1075 |
+
// THIS LINE IS CRITICAL:
|
1076 |
+
// Replace 'https://YOUR_HUGGING_FACE_SPACE_URL' with the actual, exact URL of your Hugging Face Space.
|
1077 |
+
// Example: 'https://huggingface.co/spaces/myusername/century-city-remic'
|
1078 |
+
'Access-Control-Allow-Origin': 'https://huggingface.co/spaces/privateuserh/ccremic-vbeta1-06',
|
1079 |
+
'Access-Control-Allow-Methods': 'POST, OPTIONS', // Crucial for POST requests
|
1080 |
+
'Access-Control-Allow-Headers': 'Content-Type', // Crucial if sending JSON (Content-Type header)
|
1081 |
+
};
|
1082 |
+
|
1083 |
+
// Handle CORS preflight requests (OPTIONS method)
|
1084 |
+
if (request.method === 'OPTIONS') {
|
1085 |
+
return new Response(null, {
|
1086 |
+
status: 204, // No content, just send headers
|
1087 |
+
headers: corsHeaders,
|
1088 |
+
});
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
// Handle POST request to /submit-offer
|
1092 |
+
if (request.method === 'POST' && url.pathname === '/submit-offer') {
|
1093 |
+
try {
|
1094 |
+
const data = await request.json();
|
1095 |
+
console.log('Received submission:', data);
|
1096 |
+
|
1097 |
+
// Your backend processing logic here...
|
1098 |
+
|
1099 |
+
return new Response(JSON.stringify({ message: 'Offer submitted successfully!', data }), {
|
1100 |
+
headers: { 'Content-Type': 'application/json', ...corsHeaders }, // Include CORS headers in the actual response
|
1101 |
+
status: 200,
|
1102 |
+
});
|
1103 |
+
} catch (error) {
|
1104 |
+
return new Response(JSON.stringify({ error: 'Invalid JSON or processing error', details: error.message }), {
|
1105 |
+
headers: { 'Content-Type': 'application/json', ...corsHeaders }, // Include CORS headers in error responses too
|
1106 |
+
status: 400,
|
1107 |
+
});
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
// Default response for other requests
|
1112 |
+
return new Response('Not Found', { status: 404, headers: corsHeaders }); // Include CORS headers for other responses too, or remove if not needed for those
|
1113 |
+
},
|
1114 |
+
};
|
1115 |
+
</Script>
|
1116 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/ccremic-vbeta1-07" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
1117 |
</html>
|