Spaces:
Sleeping
Sleeping
Update app-backup.py
Browse files- app-backup.py +149 -78
app-backup.py
CHANGED
@@ -649,100 +649,171 @@ def get_user_spaces():
|
|
649 |
vercel_deployments = get_vercel_deployments()
|
650 |
actual_vercel_count = len(vercel_deployments) if vercel_deployments else 0
|
651 |
|
|
|
652 |
html_content = f"""
|
653 |
-
<div style='
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
</a>
|
662 |
-
</
|
663 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
Found {actual_vercel_count} Vercel deployments and {len(user_spaces)} Hugging Face spaces<br>
|
665 |
(Plus {top_best_count} featured items in Top Best section)
|
666 |
</p>
|
667 |
</div>
|
668 |
-
|
669 |
-
|
670 |
-
<div
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
</div>
|
677 |
-
|
678 |
-
<!-- Vercel Deployments -->
|
679 |
{f'''
|
680 |
-
<
|
681 |
-
|
682 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
</div>
|
684 |
''' if vercel_deployments else ''}
|
685 |
-
|
686 |
-
<!-- Hugging Face Spaces -->
|
687 |
-
<
|
688 |
-
|
689 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
</div>
|
691 |
</div>
|
692 |
|
|
|
693 |
<script>
|
694 |
-
|
695 |
-
// μ’μμ μν λ‘λ
|
696 |
-
function loadLikes() {{
|
697 |
-
const cards = document.querySelectorAll('.vercel-card');
|
698 |
-
cards.forEach(card => {{
|
699 |
-
const cardId = card.id;
|
700 |
-
const likes = localStorage.getItem(cardId) || 0;
|
701 |
-
card.querySelector('.like-count').textContent = likes;
|
702 |
-
card.dataset.likes = likes;
|
703 |
-
updateLikeButton(card, likes > 0);
|
704 |
-
}});
|
705 |
-
sortCards();
|
706 |
-
}}
|
707 |
-
|
708 |
-
// μ’μμ λ²νΌ ν κΈ
|
709 |
-
window.toggleLike = function(cardId) {{
|
710 |
-
const card = document.getElementById(cardId);
|
711 |
-
const likeCount = parseInt(localStorage.getItem(cardId) || 0);
|
712 |
-
const newCount = likeCount > 0 ? 0 : 1;
|
713 |
-
|
714 |
-
localStorage.setItem(cardId, newCount);
|
715 |
-
card.querySelector('.like-count').textContent = newCount;
|
716 |
-
card.dataset.likes = newCount;
|
717 |
-
updateLikeButton(card, newCount > 0);
|
718 |
-
|
719 |
-
sortCards();
|
720 |
-
}}
|
721 |
-
|
722 |
-
// μ’μμ λ²νΌ μν μ
λ°μ΄νΈ
|
723 |
-
function updateLikeButton(card, isLiked) {{
|
724 |
-
const button = card.querySelector('.like-button');
|
725 |
-
button.textContent = isLiked ? 'β€οΈ' : 'π€';
|
726 |
-
}}
|
727 |
-
|
728 |
-
// μΉ΄λ μ λ ¬
|
729 |
-
function sortCards() {{
|
730 |
-
const container = document.getElementById('vercel-container');
|
731 |
-
const cards = Array.from(container.children);
|
732 |
-
|
733 |
-
cards.sort((a, b) => {{
|
734 |
-
return parseInt(b.dataset.likes) - parseInt(a.dataset.likes);
|
735 |
-
}});
|
736 |
-
|
737 |
-
cards.forEach(card => container.appendChild(card));
|
738 |
-
}}
|
739 |
-
|
740 |
-
// μ΄κΈ° λ‘λ
|
741 |
-
loadLikes();
|
742 |
-
}});
|
743 |
</script>
|
744 |
"""
|
745 |
-
|
746 |
return html_content
|
747 |
|
748 |
except Exception as e:
|
|
|
649 |
vercel_deployments = get_vercel_deployments()
|
650 |
actual_vercel_count = len(vercel_deployments) if vercel_deployments else 0
|
651 |
|
652 |
+
|
653 |
html_content = f"""
|
654 |
+
<div style='
|
655 |
+
min-height: 100vh;
|
656 |
+
background: linear-gradient(135deg, #f6f8ff 0%, #f0f4ff 100%);
|
657 |
+
background-image: url("data:image/svg+xml,%3Csvg width='100' height='20' viewBox='0 0 100 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.184 20c.357-.13.72-.264 1.088-.402l1.768-.661C33.64 15.347 39.647 14 50 14c10.271 0 15.362 1.222 24.629 4.928.955.383 1.869.74 2.75 1.072h6.225c-2.51-.73-5.139-1.691-8.233-2.928C65.888 13.278 60.562 12 50 12c-10.626 0-16.855 1.397-26.66 5.063l-1.767.662c-2.475.923-4.66 1.674-6.724 2.275h6.335zm0-20C13.258 2.892 8.077 4 0 4V2c5.744 0 9.951-.574 14.85-2h6.334zM77.38 0C85.239 2.966 90.502 4 100 4V2c-6.842 0-11.386-.542-16.396-2h-6.225zM0 14c8.44 0 13.718-1.21 22.272-4.402l1.768-.661C33.64 5.347 39.647 4 50 4c10.271 0 15.362 1.222 24.629 4.928C84.112 12.722 89.438 14 100 14v-2c-10.271 0-15.362-1.222-24.629-4.928C65.888 3.278 60.562 2 50 2 39.374 2 33.145 3.397 23.34 7.063l-1.767.662C13.223 10.84 8.163 12 0 12v2z' fill='%23f0f0f0' fill-opacity='0.2' fill-rule='evenodd'/%3E%3C/svg%3E");
|
658 |
+
padding: 40px;
|
659 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;'>
|
660 |
+
|
661 |
+
<!-- λ©μΈ ν€λ -->
|
662 |
+
<div style='
|
663 |
+
background: rgba(255, 255, 255, 0.8);
|
664 |
+
border-radius: 20px;
|
665 |
+
padding: 30px;
|
666 |
+
margin-bottom: 40px;
|
667 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.05);
|
668 |
+
backdrop-filter: blur(10px);
|
669 |
+
border: 1px solid rgba(255,255,255,0.8);'>
|
670 |
+
|
671 |
+
<h2 style='
|
672 |
+
color: #2d2d2d;
|
673 |
+
margin: 0 0 15px 0;
|
674 |
+
font-size: 2em;
|
675 |
+
background: linear-gradient(45deg, #2d2d2d, #0084ff);
|
676 |
+
-webkit-background-clip: text;
|
677 |
+
-webkit-text-fill-color: transparent;'>
|
678 |
+
κ³΅κ° κ°€λ¬λ¦¬(μμ± Web/App) by MOUSE
|
679 |
+
</h2>
|
680 |
+
|
681 |
+
<div style='
|
682 |
+
background: linear-gradient(45deg, #0084ff, #00a3ff);
|
683 |
+
border-radius: 10px;
|
684 |
+
padding: 15px;
|
685 |
+
margin: 20px 0;'>
|
686 |
+
<a href='https://openfree-mouse.hf.space'
|
687 |
+
target='_blank'
|
688 |
+
style='
|
689 |
+
color: white;
|
690 |
+
text-decoration: none;
|
691 |
+
font-size: 1.1em;
|
692 |
+
display: block;
|
693 |
+
text-align: center;'>
|
694 |
+
π ν둬ννΈλ§μΌλ‘ λλ§μ μΉμλΉμ€λ₯Ό μ¦μ μμ±νλ MOUSE
|
695 |
</a>
|
696 |
+
</div>
|
697 |
+
|
698 |
+
<p style='
|
699 |
+
color: #666;
|
700 |
+
margin: 0;
|
701 |
+
font-size: 0.9em;
|
702 |
+
text-align: center;
|
703 |
+
background: rgba(255,255,255,0.5);
|
704 |
+
padding: 10px;
|
705 |
+
border-radius: 10px;'>
|
706 |
Found {actual_vercel_count} Vercel deployments and {len(user_spaces)} Hugging Face spaces<br>
|
707 |
(Plus {top_best_count} featured items in Top Best section)
|
708 |
</p>
|
709 |
</div>
|
710 |
+
|
711 |
+
<!-- Top Best μΉμ
-->
|
712 |
+
<div class="section-container" style='
|
713 |
+
background: rgba(255, 255, 255, 0.4);
|
714 |
+
border-radius: 20px;
|
715 |
+
padding: 30px;
|
716 |
+
margin: 20px 0;
|
717 |
+
backdrop-filter: blur(10px);'>
|
718 |
+
|
719 |
+
<h3 style='
|
720 |
+
color: #2d2d2d;
|
721 |
+
margin: 0 0 20px 0;
|
722 |
+
padding: 15px 25px;
|
723 |
+
background: rgba(255,255,255,0.7);
|
724 |
+
border-radius: 15px;
|
725 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
726 |
+
border-left: 5px solid #0084ff;
|
727 |
+
display: flex;
|
728 |
+
align-items: center;
|
729 |
+
gap: 10px;'>
|
730 |
+
<span style='font-size: 1.5em;'>π</span>
|
731 |
+
Top Best
|
732 |
+
</h3>
|
733 |
+
|
734 |
+
<div style='
|
735 |
+
display: grid;
|
736 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
737 |
+
gap: 20px;'>
|
738 |
+
{"".join(get_vercel_card(
|
739 |
+
{"url": url["url"], "created": url["created"], "name": url["name"], "state": url["state"]},
|
740 |
+
idx,
|
741 |
+
is_top_best=True
|
742 |
+
) for idx, url in enumerate(TOP_BEST_URLS))}
|
743 |
+
</div>
|
744 |
</div>
|
745 |
+
|
746 |
+
<!-- Vercel Deployments μΉμ
-->
|
747 |
{f'''
|
748 |
+
<div class="section-container" style='
|
749 |
+
background: rgba(255, 255, 255, 0.4);
|
750 |
+
border-radius: 20px;
|
751 |
+
padding: 30px;
|
752 |
+
margin: 20px 0;
|
753 |
+
backdrop-filter: blur(10px);'>
|
754 |
+
|
755 |
+
<h3 style='
|
756 |
+
color: #2d2d2d;
|
757 |
+
margin: 0 0 20px 0;
|
758 |
+
padding: 15px 25px;
|
759 |
+
background: rgba(255,255,255,0.7);
|
760 |
+
border-radius: 15px;
|
761 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
762 |
+
border-left: 5px solid #00a3ff;
|
763 |
+
display: flex;
|
764 |
+
align-items: center;
|
765 |
+
gap: 10px;'>
|
766 |
+
<span style='font-size: 1.5em;'>β‘</span>
|
767 |
+
Vercel Deployments
|
768 |
+
</h3>
|
769 |
+
|
770 |
+
<div id="vercel-container" style='
|
771 |
+
display: grid;
|
772 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
773 |
+
gap: 20px;'>
|
774 |
+
{"".join(get_vercel_card(dep, idx) for idx, dep in enumerate(vercel_deployments))}
|
775 |
+
</div>
|
776 |
</div>
|
777 |
''' if vercel_deployments else ''}
|
778 |
+
|
779 |
+
<!-- Hugging Face Spaces μΉμ
-->
|
780 |
+
<div class="section-container" style='
|
781 |
+
background: rgba(255, 255, 255, 0.4);
|
782 |
+
border-radius: 20px;
|
783 |
+
padding: 30px;
|
784 |
+
margin: 20px 0;
|
785 |
+
backdrop-filter: blur(10px);'>
|
786 |
+
|
787 |
+
<h3 style='
|
788 |
+
color: #2d2d2d;
|
789 |
+
margin: 0 0 20px 0;
|
790 |
+
padding: 15px 25px;
|
791 |
+
background: rgba(255,255,255,0.7);
|
792 |
+
border-radius: 15px;
|
793 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
794 |
+
border-left: 5px solid #ff6b6b;
|
795 |
+
display: flex;
|
796 |
+
align-items: center;
|
797 |
+
gap: 10px;'>
|
798 |
+
<span style='font-size: 1.5em;'>π€</span>
|
799 |
+
Hugging Face Spaces
|
800 |
+
</h3>
|
801 |
+
|
802 |
+
<div style='
|
803 |
+
display: grid;
|
804 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
805 |
+
gap: 20px;'>
|
806 |
+
{"".join(get_space_card(space, idx) for idx, space in enumerate(user_spaces))}
|
807 |
+
</div>
|
808 |
</div>
|
809 |
</div>
|
810 |
|
811 |
+
<!-- κΈ°μ‘΄ JavaScript μ½λλ κ·Έλλ‘ μ μ§ -->
|
812 |
<script>
|
813 |
+
// ... (κΈ°μ‘΄ JavaScript μ½λ)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
814 |
</script>
|
815 |
"""
|
816 |
+
|
817 |
return html_content
|
818 |
|
819 |
except Exception as e:
|