File size: 1,795 Bytes
f137f6d
4c803a4
f137f6d
4c803a4
 
 
 
 
 
 
 
 
 
 
 
f137f6d
4c803a4
 
 
 
f137f6d
 
4c803a4
f137f6d
 
4c803a4
f137f6d
 
4c803a4
 
 
 
 
 
f137f6d
 
4c803a4
 
 
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
import os

print("🔧 [Patch Backend] Safely patching LinkedIn scopes list...")
count = 0
for root, dirs, files in os.walk("/app"):
    if ".next" in root or "node_modules/.cache" in root:
        continue
    for f in files:
        if f.endswith(".js"):
            path = os.path.join(root, f)
            try:
                with open(path, "r", encoding="utf-8", errors="ignore") as file:
                    content = file.read()
                
                modified = False
                # Remove prompt=none
                if "prompt=none" in content:
                    content = content.replace("&prompt=none", "").replace("prompt=none&", "").replace("prompt=none", "")
                    modified = True
                
                # Safely clean out organization and deprecated scopes from scope lists
                for scope in [
                    '"r_basicprofile",', '"rw_organization_admin",', '"w_organization_social",', '"r_organization_social",', ',"r_organization_social"',
                    "'r_basicprofile',", "'rw_organization_admin',", "'w_organization_social',", "'r_organization_social',", ",'r_organization_social'",
                    'r_basicprofile ', 'rw_organization_admin ', 'w_organization_social ', 'r_organization_social'
                ]:
                    if scope in content:
                        content = content.replace(scope, "")
                        modified = True

                if modified:
                    with open(path, "w", encoding="utf-8") as file:
                        file.write(content)
                    count += 1
                    print(f"  ✅ Safely Patched: {path}")
            except Exception:
                pass

print(f"🔧 [Patch Backend] Successfully patched {count} files.")