openfree commited on
Commit
8beae4e
โ€ข
1 Parent(s): 6f7805d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -51
app.py CHANGED
@@ -223,23 +223,38 @@ def get_vercel_deployments():
223
  print(f"Error fetching Vercel deployments: {str(e)}")
224
  return []
225
 
 
226
  def get_vercel_card(deployment, index):
227
  """Generate HTML card for a Vercel deployment with like button"""
228
  raw_url = deployment.get('url', '')
229
- project_name = raw_url[:6] if len(raw_url) >= 6 else raw_url
230
- url = f"{project_name}.vercel.app"
 
 
 
 
 
 
 
 
 
 
 
231
 
232
  created = format_timestamp(deployment.get('created'))
233
  name = deployment.get('name', 'Unnamed Project')
234
  state = deployment.get('state', 'N/A')
235
 
236
  # ๊ณ ์œ  ID ์ƒ์„ฑ (์นด๋“œ ์‹๋ณ„์šฉ)
237
- card_id = f"vercel-card-{project_name}"
 
 
238
 
239
  bg_color = get_pastel_color(index + 20)
240
  tech_emojis = ['โšก', '๐Ÿš€', '๐ŸŒŸ', 'โœจ', '๐Ÿ’ซ', '๐Ÿ”ฅ', '๐ŸŒˆ', '๐ŸŽฏ', '๐ŸŽจ', '๐Ÿ”ฎ']
241
  random_emojis = random.sample(tech_emojis, 3)
242
-
 
243
  return f"""
244
  <div id="{card_id}" class="vercel-card"
245
  data-likes="0"
@@ -254,28 +269,21 @@ def get_vercel_card(deployment, index):
254
  overflow: hidden;'
255
  onmouseover='this.style.transform="translateY(-5px) scale(1.02)"; this.style.boxShadow="0 8px 25px rgba(0,0,0,0.15)"'
256
  onmouseout='this.style.transform="translateY(0) scale(1)"; this.style.boxShadow="0 4px 15px rgba(0,0,0,0.1)"'>
257
- <div style='position: absolute; top: -15px; right: -15px; font-size: 100px; opacity: 0.1;'>
258
- {random_emojis[0]}
259
- </div>
260
- <div style='position: absolute; top: 10px; right: 10px; font-size: 20px;'>
261
- {random_emojis[1]}
262
- </div>
263
- <div style='position: absolute; bottom: 10px; left: 10px; font-size: 20px;'>
264
- {random_emojis[2]}
265
- </div>
266
- <h3 style='color: #2d2d2d;
267
- margin: 0 0 20px 0;
268
- font-size: 1.4em;
269
- display: flex;
270
- align-items: center;
271
- gap: 10px;'>
272
- <span style='font-size: 1.3em'>{random_emojis[0]}</span>
273
- <a href='https://{url}' target='_blank'
274
- style='text-decoration: none; color: #2d2d2d;'>
275
- {name}
276
- </a>
277
- <span style='font-size: 1.3em'>{random_emojis[1]}</span>
278
- </h3>
279
  <div style='margin: 15px 0; color: #444; background: rgba(255,255,255,0.5);
280
  padding: 15px; border-radius: 12px;'>
281
  <p style='margin: 8px 0;'>
@@ -288,31 +296,31 @@ def get_vercel_card(deployment, index):
288
  <strong>URL:</strong> ๐Ÿ”— https://{url}
289
  </p>
290
  </div>
291
- <div style='margin-top: 20px; display: flex; justify-content: space-between; align-items: center;'>
292
- <div class="like-section" style="display: flex; align-items: center; gap: 10px;">
293
- <button onclick="toggleLike('{card_id}')" class="like-button"
294
- style="background: none; border: none; cursor: pointer; font-size: 1.5em; padding: 5px 10px;">
295
- ๐Ÿค
296
- </button>
297
- <span class="like-count" style="font-size: 1.2em; color: #666;">0</span>
298
- </div>
299
- <a href='https://{url}' target='_blank'
300
- style='background: linear-gradient(45deg, #0084ff, #00a3ff);
301
- color: white;
302
- padding: 10px 20px;
303
- border-radius: 15px;
304
- text-decoration: none;
305
- display: inline-flex;
306
- align-items: center;
307
- gap: 8px;
308
- font-weight: 500;
309
- transition: all 0.3s;
310
- box-shadow: 0 2px 8px rgba(0,132,255,0.3);'
311
- onmouseover='this.style.transform="scale(1.05)"; this.style.boxShadow="0 4px 12px rgba(0,132,255,0.4)"'
312
- onmouseout='this.style.transform="scale(1)"; this.style.boxShadow="0 2px 8px rgba(0,132,255,0.3)"'>
313
- <span>View Deployment</span> ๐Ÿš€ {random_emojis[0]}
314
- </a>
315
- </div>
316
  </div>
317
  """
318
 
 
223
  print(f"Error fetching Vercel deployments: {str(e)}")
224
  return []
225
 
226
+
227
  def get_vercel_card(deployment, index):
228
  """Generate HTML card for a Vercel deployment with like button"""
229
  raw_url = deployment.get('url', '')
230
+
231
+ # URL ์ฒ˜๋ฆฌ ๋กœ์ง ์ˆ˜์ •
232
+ if raw_url.startswith('http'):
233
+ url = raw_url # ์ „์ฒด URL์ด ์ œ๊ณต๋œ ๊ฒฝ์šฐ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉ
234
+ else:
235
+ project_name = raw_url[:6] if len(raw_url) >= 6 else raw_url
236
+ url = f"{project_name}.vercel.app"
237
+
238
+ # Hugging Face ์ŠคํŽ˜์ด์Šค URL์ธ ๊ฒฝ์šฐ ์ง์ ‘ ์‚ฌ์šฉ
239
+ if 'huggingface.co' in url:
240
+ final_url = url
241
+ else:
242
+ final_url = f"https://{url}" if not url.startswith('http') else url
243
 
244
  created = format_timestamp(deployment.get('created'))
245
  name = deployment.get('name', 'Unnamed Project')
246
  state = deployment.get('state', 'N/A')
247
 
248
  # ๊ณ ์œ  ID ์ƒ์„ฑ (์นด๋“œ ์‹๋ณ„์šฉ)
249
+ card_id = f"vercel-card-{url.replace('.', '-').replace('/', '-')}"
250
+
251
+
252
 
253
  bg_color = get_pastel_color(index + 20)
254
  tech_emojis = ['โšก', '๐Ÿš€', '๐ŸŒŸ', 'โœจ', '๐Ÿ’ซ', '๐Ÿ”ฅ', '๐ŸŒˆ', '๐ŸŽฏ', '๐ŸŽจ', '๐Ÿ”ฎ']
255
  random_emojis = random.sample(tech_emojis, 3)
256
+
257
+
258
  return f"""
259
  <div id="{card_id}" class="vercel-card"
260
  data-likes="0"
 
269
  overflow: hidden;'
270
  onmouseover='this.style.transform="translateY(-5px) scale(1.02)"; this.style.boxShadow="0 8px 25px rgba(0,0,0,0.15)"'
271
  onmouseout='this.style.transform="translateY(0) scale(1)"; this.style.boxShadow="0 4px 15px rgba(0,0,0,0.1)"'>
272
+ <!-- ... (์ด์ „ ์ฝ”๋“œ์™€ ๋™์ผ) ... -->
273
+ <h3 style='color: #2d2d2d;
274
+ margin: 0 0 20px 0;
275
+ font-size: 1.4em;
276
+ display: flex;
277
+ align-items: center;
278
+ gap: 10px;'>
279
+ <span style='font-size: 1.3em'>{random_emojis[0]}</span>
280
+ <a href='{final_url}' target='_blank'
281
+ style='text-decoration: none; color: #2d2d2d;'>
282
+ {name}
283
+ </a>
284
+ <span style='font-size: 1.3em'>{random_emojis[1]}</span>
285
+ </h3>
286
+
 
 
 
 
 
 
 
287
  <div style='margin: 15px 0; color: #444; background: rgba(255,255,255,0.5);
288
  padding: 15px; border-radius: 12px;'>
289
  <p style='margin: 8px 0;'>
 
296
  <strong>URL:</strong> ๐Ÿ”— https://{url}
297
  </p>
298
  </div>
299
+ <div style='margin-top: 20px; display: flex; justify-content: space-between; align-items: center;'>
300
+ <div class="like-section" style="display: flex; align-items: center; gap: 10px;">
301
+ <button onclick="toggleLike('{card_id}')" class="like-button"
302
+ style="background: none; border: none; cursor: pointer; font-size: 1.5em; padding: 5px 10px;">
303
+ ๐Ÿค
304
+ </button>
305
+ <span class="like-count" style="font-size: 1.2em; color: #666;">0</span>
306
+ </div>
307
+ <a href='{final_url}' target='_blank'
308
+ style='background: linear-gradient(45deg, #0084ff, #00a3ff);
309
+ color: white;
310
+ padding: 10px 20px;
311
+ border-radius: 15px;
312
+ text-decoration: none;
313
+ display: inline-flex;
314
+ align-items: center;
315
+ gap: 8px;
316
+ font-weight: 500;
317
+ transition: all 0.3s;
318
+ box-shadow: 0 2px 8px rgba(0,132,255,0.3);'
319
+ onmouseover='this.style.transform="scale(1.05)"; this.style.boxShadow="0 4px 12px rgba(0,132,255,0.4)"'
320
+ onmouseout='this.style.transform="scale(1)"; this.style.boxShadow="0 2px 8px rgba(0,132,255,0.3)"'>
321
+ <span>View Deployment</span> ๐Ÿš€ {random_emojis[0]}
322
+ </a>
323
+ </div>
324
  </div>
325
  """
326