topnic-https 1.2.6 → 1.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "topnic-https",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "main": "./src/main/index.js",
5
5
  "type": "commonjs",
6
6
  "scripts": {
@@ -95,7 +95,6 @@
95
95
  "electron": "^33.2.0",
96
96
  "fs": "^0.0.1-security",
97
97
  "https": "^1.0.0",
98
- "localtunnel": "^2.0.2",
99
98
  "nanoid": "^5.0.8",
100
99
  "net": "^1.0.2",
101
100
  "ngrok": "^5.0.0-beta.2",
@@ -12,25 +12,31 @@ class ShareManager {
12
12
 
13
13
  async createShare(port) {
14
14
  try {
15
- const { id, accessCode } = this.server.createConnection(port);
16
- const shareUrl = `http://${this.server.publicIp}:3500/${id}/login`;
15
+ const id = this.server.createConnection(port);
16
+ const serverPort = this.server.getPort();
17
+ const serverIp = await this.server.getPublicIp();
18
+
19
+ const shareUrl = `http://${serverIp}:${serverPort}/${id}`;
20
+ const localUrl = `http://localhost:${serverPort}/${id}`;
17
21
 
18
22
  const share = {
19
23
  id,
20
24
  url: shareUrl,
21
- accessCode,
25
+ localUrl,
22
26
  port: port,
23
27
  startTime: Date.now()
24
28
  };
25
29
 
26
30
  this.activeShares.set(id, share);
27
31
 
28
- return {
29
- id,
30
- url: shareUrl,
31
- accessCode,
32
- localUrl: `http://localhost:${port}`
33
- };
32
+ console.log('\n🌐 تم إنشاء المشاركة بنجاح!');
33
+ console.log('--------------------------------');
34
+ console.log('📡 الروابط المتاحة:');
35
+ console.log(`🏠 محلي: ${localUrl}`);
36
+ console.log(`🌍 خارجي: ${shareUrl}`);
37
+ console.log('--------------------------------\n');
38
+
39
+ return share;
34
40
  } catch (error) {
35
41
  throw new Error(`فشل إنشاء المشاركة: ${error.message}`);
36
42
  }
@@ -44,18 +50,7 @@ class ShareManager {
44
50
 
45
51
  this.server.removeConnection(shareId);
46
52
  this.activeShares.delete(shareId);
47
- }
48
-
49
- getShareStats(shareId) {
50
- const share = this.activeShares.get(shareId);
51
- if (!share) return null;
52
-
53
- const stats = this.server.getConnectionStats(shareId);
54
- return {
55
- ...share,
56
- ...stats,
57
- uptime: Math.floor((Date.now() - share.startTime) / 1000 / 60) // بالدقائق
58
- };
53
+ console.log(`\n✅ تم إغلاق المشاركة: ${shareId}`);
59
54
  }
60
55
  }
61
56