Spaces:
Running
Running
PabloRomeroAgudo
commited on
Commit
•
63b55fd
1
Parent(s):
68ede9a
Update index.html
Browse filesPrepared code to download realease
- index.html +35 -9
index.html
CHANGED
@@ -102,28 +102,21 @@
|
|
102 |
|
103 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
104 |
|
|
|
105 |
<script>
|
106 |
$(document).ready(function () {
|
107 |
// Replace 'YOUR_PROJECT_ID' and 'YOUR_REPO_NAME' with your GitLab project ID and repository name
|
108 |
var projectId = '25472370';
|
109 |
var repoName = 'charp-viewer';
|
110 |
-
|
111 |
-
// GitLab API endpoint for releases
|
112 |
-
var apiUrl = 'https://gitlab.com/api/v4/projects/'+projectId+'/releases/'//+tag_name+'/assets/links'
|
113 |
-
//var apiUrl = 'https://gitlab.com/api/v4/projects/' + projectId + '/repository/tags'; -->
|
114 |
-
|
115 |
-
// Fetch the latest release information
|
116 |
|
117 |
$.ajax({
|
118 |
url: apiUrl,
|
119 |
method: 'GET',
|
120 |
success: function (data) {
|
121 |
-
console.log("data",data);
|
122 |
if (data.length > 0) {
|
123 |
var latestRelease = data[0];
|
124 |
-
console.log("latestRelease",latestRelease);
|
125 |
var releaseAssets = latestRelease.assets;
|
126 |
-
console.log("releaseAssets",releaseAssets);
|
127 |
// Assuming the first asset is the desired download (e.g., a zip file)
|
128 |
var downloadUrl = releaseAssets.sources.length > 0 ? releaseAssets.sources[0].url : '';
|
129 |
|
@@ -138,6 +131,39 @@
|
|
138 |
});
|
139 |
</script>
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
142 |
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
|
143 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
|
|
102 |
|
103 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
104 |
|
105 |
+
<!--Wei Repo-->
|
106 |
<script>
|
107 |
$(document).ready(function () {
|
108 |
// Replace 'YOUR_PROJECT_ID' and 'YOUR_REPO_NAME' with your GitLab project ID and repository name
|
109 |
var projectId = '25472370';
|
110 |
var repoName = 'charp-viewer';
|
111 |
+
var apiUrl = 'https://gitlab.com/api/v4/projects/'+projectId+'/releases/'
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
$.ajax({
|
114 |
url: apiUrl,
|
115 |
method: 'GET',
|
116 |
success: function (data) {
|
|
|
117 |
if (data.length > 0) {
|
118 |
var latestRelease = data[0];
|
|
|
119 |
var releaseAssets = latestRelease.assets;
|
|
|
120 |
// Assuming the first asset is the desired download (e.g., a zip file)
|
121 |
var downloadUrl = releaseAssets.sources.length > 0 ? releaseAssets.sources[0].url : '';
|
122 |
|
|
|
131 |
});
|
132 |
</script>
|
133 |
|
134 |
+
<!-- Parrot repo
|
135 |
+
<script>
|
136 |
+
$(document).ready(function () {
|
137 |
+
// Replace 'YOUR_PROJECT_ID' and 'YOUR_REPO_NAME' with your GitLab project ID and repository name
|
138 |
+
// Parrot repo
|
139 |
+
var projectId = '54838381';
|
140 |
+
var repoName = 'PARROT';
|
141 |
+
|
142 |
+
var apiUrl = 'https://gitlab.com/api/v4/projects/'+projectId+'/releases/'
|
143 |
+
|
144 |
+
$.ajax({
|
145 |
+
url: apiUrl,
|
146 |
+
method: 'GET',
|
147 |
+
success: function (data) {
|
148 |
+
if (data.length > 0) {
|
149 |
+
var latestRelease = data[0];
|
150 |
+
// Get the latest release
|
151 |
+
var releaseAssets = latestRelease.assets;
|
152 |
+
// The file is in the link array, and assuming we want to download the first link (.exe), we look for his URL
|
153 |
+
var downloadUrl = releaseAssets.length > 0 ? releaseAssets.links[0].url : '';
|
154 |
+
|
155 |
+
// Update the download button href attribute
|
156 |
+
$('#downloadButton').attr('onclick', 'window.location.href="' + downloadUrl + '"');
|
157 |
+
}
|
158 |
+
},
|
159 |
+
error: function (error) {
|
160 |
+
console.error('Error fetching release information:', error);
|
161 |
+
}
|
162 |
+
});
|
163 |
+
});
|
164 |
+
</script>
|
165 |
+
-->
|
166 |
+
|
167 |
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
168 |
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
|
169 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|