File size: 11,755 Bytes
0e1e93d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Latest Odoo Version Checker</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #714B67;
            --secondary-color: #F5E6E8;
            --accent-color: #A076F9;
            --text-color: #333;
            --light-text: #666;
            --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            --border-radius: 12px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: var(--secondary-color);
            color: var(--text-color);
            line-height: 1.6;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        header {
            background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
            color: white;
            padding: 1.5rem;
            text-align: center;
            box-shadow: var(--shadow);
        }

        .container {
            max-width: 800px;
            margin: 2rem auto;
            padding: 0 1rem;
            flex: 1;
        }

        .version-card {
            background: white;
            border-radius: var(--border-radius);
            padding: 2rem;
            box-shadow: var(--shadow);
            text-align: center;
            margin-bottom: 2rem;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .version-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        }

        .version-number {
            font-size: 3rem;
            font-weight: 700;
            margin: 1rem 0;
            color: var(--primary-color);
            background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .version-info {
            display: flex;
            justify-content: space-around;
            margin: 2rem 0;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .info-item {
            text-align: center;
            padding: 1rem;
            background: rgba(113, 75, 103, 0.1);
            border-radius: var(--border-radius);
            flex: 1;
            min-width: 150px;
        }

        .info-item i {
            font-size: 2rem;
            color: var(--accent-color);
            margin-bottom: 0.5rem;
        }

        .loading {
            display: inline-block;
            width: 50px;
            height: 50px;
            border: 5px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .btn {
            display: inline-block;
            background: var(--primary-color);
            color: white;
            padding: 0.8rem 1.5rem;
            border-radius: var(--border-radius);
            text-decoration: none;
            font-weight: 600;
            transition: all 0.3s ease;
            border: none;
            cursor: pointer;
            margin-top: 1rem;
        }

        .btn:hover {
            background: var(--accent-color);
            transform: translateY(-2px);
        }

        .error {
            color: #e74c3c;
            font-weight: 600;
        }

        footer {
            text-align: center;
            padding: 1.5rem;
            background: white;
            color: var(--light-text);
            font-size: 0.9rem;
        }

        .anycoder-link {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 600;
            margin-left: 0.5rem;
        }

        .anycoder-link:hover {
            text-decoration: underline;
        }

        .release-notes {
            background: white;
            border-radius: var(--border-radius);
            padding: 1.5rem;
            box-shadow: var(--shadow);
            margin-top: 2rem;
        }

        .release-notes h3 {
            margin-bottom: 1rem;
            color: var(--primary-color);
        }

        .release-notes ul {
            list-style-type: none;
            padding-left: 0;
        }

        .release-notes li {
            padding: 0.5rem 0;
            border-bottom: 1px solid #eee;
        }

        .release-notes li:last-child {
            border-bottom: none;
        }

        @media (max-width: 768px) {
            .version-number {
                font-size: 2.5rem;
            }

            .version-info {
                flex-direction: column;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 0 0.5rem;
            }

            .version-card {
                padding: 1.5rem;
            }
        }
    </style>
</head>
<body>
    <header>
        <h1><i class="fab fa-odoo"></i> Odoo Version Checker</h1>
        <p>Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="anycoder-link" target="_blank">anycoder</a></p>
    </header>

    <div class="container">
        <div class="version-card">
            <h2>Latest Odoo Version</h2>
            <div id="version-display">
                <div class="loading"></div>
                <p>Fetching latest version...</p>
            </div>
            <button id="refresh-btn" class="btn"><i class="fas fa-sync-alt"></i> Refresh</button>
        </div>

        <div class="version-info" id="version-info">
            <!-- Will be populated by JavaScript -->
        </div>

        <div class="release-notes" id="release-notes">
            <h3><i class="fas fa-file-alt"></i> Latest Release Notes</h3>
            <p>Loading release information...</p>
        </div>
    </div>

    <footer>
        <p>Data fetched from Odoo's official GitHub repository</p>
    </footer>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const versionDisplay = document.getElementById('version-display');
            const versionInfo = document.getElementById('version-info');
            const releaseNotes = document.getElementById('release-notes');
            const refreshBtn = document.getElementById('refresh-btn');

            // Fetch latest Odoo version from GitHub
            async function fetchLatestVersion() {
                try {
                    versionDisplay.innerHTML = '<div class="loading"></div><p>Fetching latest version...</p>';

                    // Fetch tags from Odoo GitHub repository
                    const response = await fetch('https://api.github.com/repos/odoo/odoo/tags');
                    const tags = await response.json();

                    if (tags.length === 0) {
                        throw new Error('No tags found');
                    }

                    // Filter out non-version tags and find the latest version
                    const versionTags = tags
                        .map(tag => tag.name)
                        .filter(name => /^\d+\.\d+$/.test(name))
                        .sort((a, b) => {
                            const aParts = a.split('.').map(Number);
                            const bParts = b.split('.').map(Number);
                            return bParts[0] - aParts[0] || bParts[1] - aParts[1];
                        });

                    if (versionTags.length === 0) {
                        throw new Error('No valid version tags found');
                    }

                    const latestVersion = versionTags[0];
                    const latestTag = tags.find(tag => tag.name === latestVersion);

                    // Display version
                    versionDisplay.innerHTML = `
                        <div class="version-number">${latestVersion}</div>
                        <p>Released on: ${new Date(latestTag.commit.author.date).toLocaleDateString()}</p>
                    `;

                    // Display additional info
                    versionInfo.innerHTML = `
                        <div class="info-item">
                            <i class="fas fa-tag"></i>
                            <div>Latest Tag</div>
                            <div>${latestTag.name}</div>
                        </div>
                        <div class="info-item">
                            <i class="fas fa-calendar"></i>
                            <div>Published At</div>
                            <div>${new Date(latestTag.commit.author.date).toLocaleString()}</div>
                        </div>
                        <div class="info-item">
                            <i class="fas fa-code-branch"></i>
                            <div>Commit SHA</div>
                            <div>${latestTag.commit.sha.substring(0, 7)}</div>
                        </div>
                    `;

                    // Fetch release notes (using GitHub releases API)
                    try {
                        const releasesResponse = await fetch('https://api.github.com/repos/odoo/odoo/releases');
                        const releases = await releasesResponse.json();

                        const latestRelease = releases.find(release =>
                            release.tag_name === latestVersion ||
                            release.name.includes(latestVersion)
                        );

                        if (latestRelease) {
                            const notes = latestRelease.body.split('\n').filter(line => line.trim() !== '');
                            releaseNotes.innerHTML = `
                                <h3><i class="fas fa-file-alt"></i> Release Notes for v${latestVersion}</h3>
                                <ul>
                                    ${notes.slice(0, 5).map(note => `<li>${note}</li>`).join('')}
                                </ul>
                                <a href="${latestRelease.html_url}" class="btn" target="_blank">
                                    <i class="fas fa-external-link-alt"></i> View Full Release
                                </a>
                            `;
                        } else {
                            releaseNotes.innerHTML = `
                                <h3><i class="fas fa-file-alt"></i> Release Notes</h3>
                                <p>No specific release notes found for this version.</p>
                            `;
                        }
                    } catch (error) {
                        releaseNotes.innerHTML = `
                            <h3><i class="fas fa-file-alt"></i> Release Notes</h3>
                            <p class="error">Could not fetch release notes: ${error.message}</p>
                        `;
                    }

                } catch (error) {
                    versionDisplay.innerHTML = `
                        <p class="error">Error fetching version: ${error.message}</p>
                        <p>Please try again later.</p>
                    `;
                    console.error('Error:', error);
                }
            }

            // Initial fetch
            fetchLatestVersion();

            // Refresh button
            refreshBtn.addEventListener('click', fetchLatestVersion);
        });
    </script>
</body>
</html>