Spaces:
Running
Running
Commit
·
9484eef
1
Parent(s):
f2e8e3c
fixed bad link that lead to 404. updated video to youtube. removed debug message
Browse files- hf_server.js +18 -18
hf_server.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* All rights reserved.
|
4 |
*/
|
5 |
//@ts-check
|
6 |
-
const VERSION = '0.6.0.hf.015.
|
7 |
|
8 |
const express = require('express');
|
9 |
const http = require('http');
|
@@ -52,8 +52,8 @@ console.log(`************ Omnitool Proxy Server v${VERSION} ************`);
|
|
52 |
|
53 |
// HTML templates and constants
|
54 |
const LOG_CONTAINER_HTML = `<div id="logContainer"></div>`;
|
55 |
-
const COMMON_STYLES =
|
56 |
-
|
57 |
#logContainer {
|
58 |
height: 400px;
|
59 |
overflow-y: scroll;
|
@@ -98,8 +98,8 @@ const COMMON_STYLES = `
|
|
98 |
}
|
99 |
</style>`;
|
100 |
|
101 |
-
|
102 |
-
|
103 |
// Script to check Hugging Face login status and control 'Clone Repo' button
|
104 |
|
105 |
function startServer() {
|
@@ -119,7 +119,7 @@ const COMMON_STYLES = `
|
|
119 |
if (window.self !== window.top)
|
120 |
{
|
121 |
// open a new window to get out of the iframe, then wait 1s, then fetch burst-iframe then reload
|
122 |
-
window.open(
|
123 |
}
|
124 |
else
|
125 |
{
|
@@ -182,14 +182,18 @@ const COMMON_STYLES = `
|
|
182 |
</script>`;
|
183 |
|
184 |
const INTRO_MESSAGE =
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
193 |
async function startOmnitoolServer()
|
194 |
{
|
195 |
if (global.ALREADY_STARTING) return;
|
@@ -375,7 +379,6 @@ async function handleGetRoot(req, res)
|
|
375 |
page_message += '<div>Duplicating the Space will secure your keys, recipes and outputs.</p>';
|
376 |
page_message += `<div>DUPLICATING and using your own SPACE is FREE. You can do it by pressing this button: <a href="${HF_SPACE_DUPLICATE_URL}" target="_blank" class="button-like-link" id="duplicateRepoButton">DUPLICATE SPACE</a></div><div>However, consider choosing the 20 Gig Storage option (~ 5 USD/month) to persist keys, recipes and outputs between server restarts.</div>`;
|
377 |
page_message += '<p></p>';
|
378 |
-
const VIDEO_PLAYER_MESSAGE = '<div class="framer-epi0t3" data-framer-name="Video" name="Video"><div class="framer-ggzo55-container" data-framer-appear-id="vblmde" id="ZjfrOcqXP" style="opacity: 1; transform: perspective(1200px);"><div style="background:rgba(0, 0, 0, 0);height:100%;width:100%;border-radius:20px;position:relative;display:flex;justify-content:center;align-items:center;overflow:hidden" height="100%" id="ZjfrOcqXP" width="100%"><div class="framer-vimeo" data-vimeo-initialized="true" style="width: 100%; height: 100%;"><div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/879084807?autopause=0&app_id=122963" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="OMITOOL-DEMO" data-ready="true"></iframe></div></div></div></div></div>'
|
379 |
|
380 |
let buttonsHTML = `
|
381 |
<a href="${HF_SPACE_DUPLICATE_URL}" target="_blank" class="button-like-link" id="duplicateRepoButton">DUPLICATE SPACE</a>`;
|
@@ -387,7 +390,6 @@ async function handleGetRoot(req, res)
|
|
387 |
${COMMON_STYLES}
|
388 |
</head>
|
389 |
<body>
|
390 |
-
<div>req.session.isVisited = ${req.session.isVisited}</div>
|
391 |
${INTRO_MESSAGE}
|
392 |
${page_message}
|
393 |
<p></p>
|
@@ -422,7 +424,6 @@ async function handleGetRoot(req, res)
|
|
422 |
${COMMON_STYLES}
|
423 |
</head>
|
424 |
<body>
|
425 |
-
<div>req.session.isVisited = ${req.session.isVisited}</div>
|
426 |
${INTRO_MESSAGE}
|
427 |
${page_message}
|
428 |
<p></p>
|
@@ -457,7 +458,6 @@ async function handleGetRoot(req, res)
|
|
457 |
${COMMON_STYLES}
|
458 |
</head>
|
459 |
<body>
|
460 |
-
<div>req.session.isVisited = ${req.session.isVisited}</div>
|
461 |
${INTRO_MESSAGE}
|
462 |
${page_message}
|
463 |
<p></p>
|
|
|
3 |
* All rights reserved.
|
4 |
*/
|
5 |
//@ts-check
|
6 |
+
const VERSION = '0.6.0.hf.015.c';
|
7 |
|
8 |
const express = require('express');
|
9 |
const http = require('http');
|
|
|
52 |
|
53 |
// HTML templates and constants
|
54 |
const LOG_CONTAINER_HTML = `<div id="logContainer"></div>`;
|
55 |
+
const COMMON_STYLES =
|
56 |
+
`<style>
|
57 |
#logContainer {
|
58 |
height: 400px;
|
59 |
overflow-y: scroll;
|
|
|
98 |
}
|
99 |
</style>`;
|
100 |
|
101 |
+
const SCRIPTS =
|
102 |
+
`<script>
|
103 |
// Script to check Hugging Face login status and control 'Clone Repo' button
|
104 |
|
105 |
function startServer() {
|
|
|
119 |
if (window.self !== window.top)
|
120 |
{
|
121 |
// open a new window to get out of the iframe, then wait 1s, then fetch burst-iframe then reload
|
122 |
+
window.open(${global.LOCAL_URL}+"?isVisited=true", '_blank');
|
123 |
}
|
124 |
else
|
125 |
{
|
|
|
182 |
</script>`;
|
183 |
|
184 |
const INTRO_MESSAGE =
|
185 |
+
`<h1>Omnitool.ai on Hugging Face</h1>
|
186 |
+
<p>Version: ${VERSION}</p>
|
187 |
+
<div>Welcome to Omnitool.ai, running on Hugging Face!</div>
|
188 |
+
<div>For more details, including how to install omnitool on your own computer for free,</div>
|
189 |
+
<div>visit us at <a href="https://omnitool.ai" target="_blank" class="button-like-link" id="duplicateRepoButton">omnitool.ai</a></div>
|
190 |
+
<p></p>
|
191 |
+
<p></p>`;
|
192 |
+
|
193 |
+
const VIDEO_PLAYER_MESSAGE =
|
194 |
+
'<div class="framer-epi0t3" data-framer-name="Video" name="Video"><div class="framer-ggzo55-container" data-framer-appear-id="vblmde" id="ZjfrOcqXP" style="opacity: 1; transform: perspective(1200px);"><div style="background:rgba(0, 0, 0, 0);height:100%;width:100%;border-radius:20px;position:relative;display:flex;justify-content:center;align-items:center;overflow:hidden" height="100%" id="ZjfrOcqXP" width="100%"><div class="framer-youtube" data-youtube-initialized="true" style="width: 100%; height: 100%;"><div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://www.youtube.com/embed/TlyaG2PKdrc" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="OMITOOL-DEMO" data-ready="true"></iframe></div></div></div></div></div>'
|
195 |
+
|
196 |
+
|
197 |
async function startOmnitoolServer()
|
198 |
{
|
199 |
if (global.ALREADY_STARTING) return;
|
|
|
379 |
page_message += '<div>Duplicating the Space will secure your keys, recipes and outputs.</p>';
|
380 |
page_message += `<div>DUPLICATING and using your own SPACE is FREE. You can do it by pressing this button: <a href="${HF_SPACE_DUPLICATE_URL}" target="_blank" class="button-like-link" id="duplicateRepoButton">DUPLICATE SPACE</a></div><div>However, consider choosing the 20 Gig Storage option (~ 5 USD/month) to persist keys, recipes and outputs between server restarts.</div>`;
|
381 |
page_message += '<p></p>';
|
|
|
382 |
|
383 |
let buttonsHTML = `
|
384 |
<a href="${HF_SPACE_DUPLICATE_URL}" target="_blank" class="button-like-link" id="duplicateRepoButton">DUPLICATE SPACE</a>`;
|
|
|
390 |
${COMMON_STYLES}
|
391 |
</head>
|
392 |
<body>
|
|
|
393 |
${INTRO_MESSAGE}
|
394 |
${page_message}
|
395 |
<p></p>
|
|
|
424 |
${COMMON_STYLES}
|
425 |
</head>
|
426 |
<body>
|
|
|
427 |
${INTRO_MESSAGE}
|
428 |
${page_message}
|
429 |
<p></p>
|
|
|
458 |
${COMMON_STYLES}
|
459 |
</head>
|
460 |
<body>
|
|
|
461 |
${INTRO_MESSAGE}
|
462 |
${page_message}
|
463 |
<p></p>
|