1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
6+ < title > AudioShelf Download</ title >
7+ < style >
8+ body {
9+ background-color : # 1e1e1e ;
10+ color : # ffffff ;
11+ font-family : sans-serif;
12+ display : flex;
13+ flex-direction : column;
14+ align-items : center;
15+ justify-content : center;
16+ height : 100vh ;
17+ margin : 0 ;
18+ text-align : center;
19+ }
20+ .container {
21+ padding : 20px ;
22+ border : 1px solid # 333 ;
23+ border-radius : 10px ;
24+ background-color : # 252526 ;
25+ max-width : 400px ;
26+ }
27+ h1 { font-size : 20px ; margin-bottom : 10px ; }
28+ p { color : # cccccc ; margin-bottom : 20px ; }
29+ .btn {
30+ display : none; /* اول مخفی است */
31+ background-color : # 007acc ;
32+ color : white;
33+ padding : 10px 20px ;
34+ text-decoration : none;
35+ border-radius : 5px ;
36+ font-weight : bold;
37+ }
38+ .btn : hover { background-color : # 005f9e ; }
39+ .loader {
40+ border : 4px solid # f3f3f3 ;
41+ border-top : 4px solid # 007acc ;
42+ border-radius : 50% ;
43+ width : 30px ;
44+ height : 30px ;
45+ animation : spin 1s linear infinite;
46+ margin : 0 auto 15px auto;
47+ }
48+ @keyframes spin { 0% { transform : rotate (0deg ); } 100% { transform : rotate (360deg ); } }
49+ </ style >
50+ < script >
51+ const user = 'M-Rajabi-dev' ;
52+ const repo = 'AudioShelf' ;
53+ const filePattern = '-Portable.zip' ;
54+
55+ fetch ( `https://api.github.com/repos/${ user } /${ repo } /releases/latest` )
56+ . then ( response => response . json ( ) )
57+ . then ( data => {
58+ const asset = data . assets . find ( a => a . name . endsWith ( filePattern ) ) ;
59+ const status = document . getElementById ( 'status' ) ;
60+ const manualBtn = document . getElementById ( 'manual-link' ) ;
61+ const loader = document . getElementById ( 'loader' ) ;
62+
63+ if ( asset ) {
64+ status . innerHTML = `Downloading <b>${ asset . name } </b>...` ;
65+ window . location . href = asset . browser_download_url ;
66+
67+ manualBtn . href = asset . browser_download_url ;
68+ manualBtn . style . display = 'inline-block' ;
69+ manualBtn . innerText = "Click here if download doesn't start" ;
70+ loader . style . display = 'none' ;
71+ } else {
72+ loader . style . display = 'none' ;
73+ status . innerHTML = "Error: File not found in the latest release." ;
74+ }
75+ } )
76+ . catch ( err => {
77+ document . getElementById ( 'loader' ) . style . display = 'none' ;
78+ document . getElementById ( 'status' ) . innerHTML = "Connection Error." ;
79+ } ) ;
80+ </ script >
81+ </ head >
82+ < body >
83+ < div class ="container ">
84+ < h1 > 🎧 AudioShelf</ h1 >
85+ < div id ="loader " class ="loader "> </ div >
86+ < p id ="status "> Finding latest version...</ p >
87+ < a id ="manual-link " class ="btn " href ="# "> Download Manually</ a >
88+ </ div >
89+ </ body >
90+ </ html >
0 commit comments