refactor: Update auto URL parsing and formatting in server.js and AutoUrlManager for consistent whitespace handling
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 18m1s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 18m1s
This commit is contained in:
+3
-3
@@ -955,7 +955,7 @@ app.get('/api/auto-urls', async (req, res) => {
|
||||
const data = await s3.getObject(params).promise();
|
||||
const fileContent = data.Body.toString('utf-8');
|
||||
const urls = fileContent.split('\n').filter(line => line).map(line => {
|
||||
const parts = line.trim().split(/\s*\|\s*/);
|
||||
const parts = line.trim().split(/\s+/);
|
||||
const url = parts[0] || '';
|
||||
const community = parts[1] || '';
|
||||
return { url, community };
|
||||
@@ -974,7 +974,7 @@ app.get('/api/auto-urls', async (req, res) => {
|
||||
// Update auto URLs in S3
|
||||
app.post('/api/auto-urls', async (req, res) => {
|
||||
const { urls } = req.body;
|
||||
const fileContent = urls.map(u => `${u.url} | ${u.community}`).join('\n');
|
||||
const fileContent = urls.map(u => `${u.url} ${u.community}`).join('\n');
|
||||
|
||||
const params = {
|
||||
Bucket: BUCKET_NAME,
|
||||
@@ -1009,7 +1009,7 @@ app.post('/api/auto-urls/process', async (req, res) => {
|
||||
const urlsData = await s3.getObject(urlsParams).promise();
|
||||
const urlsContent = urlsData.Body.toString('utf-8');
|
||||
urls = urlsContent.split('\n').filter(line => line).map(line => {
|
||||
const parts = line.trim().split(/\s*\|\s*/);
|
||||
const parts = line.trim().split(/\s+/);
|
||||
return { url: parts[0] || '', community: parts[1] || '' };
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -261,8 +261,7 @@ function AutoUrlManager() {
|
||||
<h4>Формат файла:</h4>
|
||||
<p>Файл сохраняется в формате:</p>
|
||||
<pre className="bg-light p-2 rounded">
|
||||
{`https://test.com/ips.txt | 555
|
||||
https://example.com/blacklist.txt | 666`}
|
||||
{`https://test.com/ips.txt 555\nhttps://example.com/blacklist.txt 666`}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user