jblu

jblu / FileCloud Direct Link Converter

Last active 1 month ago

Like 0

jblu revised this gist 1 month ago · 71a6601

1 file changed, 1 insertion, 1 deletion

index.html
@@ -103,7 +103,7 @@
103 103 <h1>FileCloud Direct Link Converter</h1>
104 104
105 105 <label for="inputUrl">Paste FileCloud Public Share URL:</label>
106 - <input type="text" id="inputUrl" placeholder="https://company.com..." oninput="convertLink()">
106 + <input type="text" id="inputUrl" placeholder="https://files.teramind.co/url/vj5kt2nxhrbs6rjf..." oninput="convertLink()">
107 107
108 108 <div id="errorMessage" class="error-message">Please enter a valid FileCloud URL containing 'ui/core/index.html'.</div>
109 109

jblu revised this gist 1 month ago · 01c863c

1 file changed, 180 insertions

index.html (file created)
@@ -0,0 +1,180 @@
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 + <title>FileCloud Direct Link Converter</title>
7 + <style>
8 + body {
9 + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
10 + background-color: #f4f6f9;
11 + color: #333;
12 + display: flex;
13 + justify-content: center;
14 + align-items: center;
15 + height: 100vh;
16 + margin: 0;
17 + }
18 + .container {
19 + background-color: #ffffff;
20 + padding: 30px;
21 + border-radius: 8px;
22 + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
23 + width: 100%;
24 + max-width: 600px;
25 + }
26 + h1 {
27 + font-size: 24px;
28 + color: #1e3a8a;
29 + margin-top: 0;
30 + margin-bottom: 20px;
31 + }
32 + label {
33 + font-weight: 600;
34 + display: block;
35 + margin-bottom: 8px;
36 + }
37 + input[type="text"] {
38 + width: 100%;
39 + padding: 12px;
40 + border: 1px solid #cbd5e1;
41 + border-radius: 4px;
42 + box-sizing: border-box;
43 + font-size: 14px;
44 + margin-bottom: 20px;
45 + }
46 + input[type="text"]:focus {
47 + outline: none;
48 + border-color: #3b82f6;
49 + box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
50 + }
51 + .result-box {
52 + display: none;
53 + background-color: #f8fafc;
54 + border: 1px solid #e2e8f0;
55 + border-radius: 4px;
56 + padding: 15px;
57 + margin-top: 10px;
58 + }
59 + .result-box.active {
60 + display: block;
61 + }
62 + .output-url {
63 + word-break: break-all;
64 + font-family: monospace;
65 + background-color: #e2e8f0;
66 + padding: 10px;
67 + border-radius: 4px;
68 + display: block;
69 + margin-bottom: 10px;
70 + }
71 + .btn {
72 + background-color: #2563eb;
73 + color: white;
74 + border: none;
75 + padding: 10px 16px;
76 + font-size: 14px;
77 + font-weight: 500;
78 + border-radius: 4px;
79 + cursor: pointer;
80 + transition: background-color 0.2s;
81 + }
82 + .btn:hover {
83 + background-color: #1d4ed8;
84 + }
85 + .btn-copy {
86 + background-color: #059669;
87 + }
88 + .btn-copy:hover {
89 + background-color: #047857;
90 + }
91 + .error-message {
92 + color: #dc2626;
93 + font-size: 14px;
94 + margin-top: -15px;
95 + margin-bottom: 15px;
96 + display: none;
97 + }
98 + </style>
99 + </head>
100 + <body>
101 +
102 + <div class="container">
103 + <h1>FileCloud Direct Link Converter</h1>
104 +
105 + <label for="inputUrl">Paste FileCloud Public Share URL:</label>
106 + <input type="text" id="inputUrl" placeholder="https://company.com..." oninput="convertLink()">
107 +
108 + <div id="errorMessage" class="error-message">Please enter a valid FileCloud URL containing 'ui/core/index.html'.</div>
109 +
110 + <div id="resultContainer" class="result-box">
111 + <label>Direct Download Link:</label>
112 + <span id="outputUrl" class="output-url"></span>
113 + <button class="btn btn-copy" onclick="copyToClipboard()">Copy Link</button>
114 + </div>
115 + </div>
116 +
117 + <script>
118 + function convertLink() {
119 + const inputUrlStr = document.getElementById('inputUrl').value.trim();
120 + const resultContainer = document.getElementById('resultContainer');
121 + const outputUrlSpan = document.getElementById('outputUrl');
122 + const errorMessage = document.getElementById('errorMessage');
123 +
124 + if (!inputUrlStr) {
125 + resultContainer.classList.remove('active');
126 + errorMessage.style.display = 'none';
127 + return;
128 + }
129 +
130 + // Target string to replace
131 + const targetString = "ui/core/index.html?mode=single&";
132 + const replacementString = "app/websharepro/share?";
133 +
134 + if (inputUrlStr.includes("ui/core/index.html")) {
135 + errorMessage.style.display = 'none';
136 +
137 + let convertedUrl = inputUrlStr;
138 +
139 + if (inputUrlStr.includes(targetString)) {
140 + // Perfect match replacement
141 + convertedUrl = inputUrlStr.replace(targetString, replacementString);
142 + } else {
143 + // Fallback strategy if query parameters are in a slightly different order
144 + try {
145 + const urlObj = new URL(inputUrlStr);
146 + // Replace the pathname
147 + urlObj.pathname = urlObj.pathname.replace('ui/core/index.html', 'app/websharepro/share');
148 + // Remove the mode parameter safely
149 + urlObj.searchParams.delete('mode');
150 + convertedUrl = urlObj.toString();
151 + } catch (e) {
152 + // If URL parsing fails, fallback to a strict string swap
153 + convertedUrl = inputUrlStr.replace('ui/core/index.html?', 'app/websharepro/share?').replace('mode=single&', '').replace('&mode=single', '');
154 + }
155 + }
156 +
157 + outputUrlSpan.textContent = convertedUrl;
158 + resultContainer.classList.add('active');
159 + } else {
160 + resultContainer.classList.remove('active');
161 + errorMessage.style.display = 'block';
162 + }
163 + }
164 +
165 + function copyToClipboard() {
166 + const outputText = document.getElementById('outputUrl').textContent;
167 + navigator.clipboard.writeText(outputText).then(() => {
168 + const copyBtn = document.querySelector('.btn-copy');
169 + copyBtn.textContent = 'Copied!';
170 + setTimeout(() => {
171 + copyBtn.textContent = 'Copy Link';
172 + }, 2000);
173 + }).catch(err => {
174 + alert('Failed to copy link: ', err);
175 + });
176 + }
177 + </script>
178 +
179 + </body>
180 + </html>