topnic-https 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -51,14 +51,14 @@ program
51
51
  .action(async (options) => {
52
52
  try {
53
53
  const share = await shareManager.createShare(options.port, options.duration);
54
- console.log('\nShare Information:');
54
+ console.log('\n🌍 مشاركة المشروع');
55
55
  console.log('--------------------------------');
56
- console.log(`Public URL: ${share.url}`);
57
- console.log(`Share ID: ${share.id}`);
58
- console.log(`Duration: ${options.duration} minutes`);
56
+ console.log(`📎 رابط المشاركة المباشر:`);
57
+ console.log(`${share.url}`);
58
+ console.log(`⏱️ مدة المشاركة: ${options.duration} دقيقة`);
59
59
  console.log('--------------------------------\n');
60
60
  } catch (error) {
61
- console.error('Failed to create share:', error.message);
61
+ console.error(' فشل إنشاء المشاركة:', error.message);
62
62
  }
63
63
  });
64
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "topnic-https",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "main": "./src/main/index.js",
5
5
  "type": "commonjs",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  const localtunnel = require('localtunnel');
2
- const { v4: uuidv4 } = require('uuid');
2
+ const { nanoid } = require('nanoid/non-secure');
3
3
 
4
4
  class ShareManager {
5
5
  constructor() {
@@ -8,20 +8,23 @@ class ShareManager {
8
8
 
9
9
  async createShare(port, duration) {
10
10
  try {
11
- const tunnel = await localtunnel({ port });
12
- const shareId = uuidv4().slice(0, 8);
11
+ const tunnel = await localtunnel({
12
+ port,
13
+ subdomain: nanoid(6)
14
+ });
15
+
16
+ const shareId = tunnel.url.split('https://')[1].split('.')[0];
13
17
 
14
18
  const share = {
15
19
  id: shareId,
16
20
  url: tunnel.url,
17
21
  tunnel,
18
22
  startTime: Date.now(),
19
- duration: duration * 60 * 1000 // تحويل الدقائق إلى ميلي ثانية
23
+ duration: duration * 60 * 1000
20
24
  };
21
25
 
22
26
  this.activeShares.set(shareId, share);
23
27
 
24
- // إغلاق المشاركة تلقائياً بعد انتهاء المدة
25
28
  setTimeout(() => {
26
29
  this.closeShare(shareId);
27
30
  }, share.duration);