Skip to content

Commit 2beed42

Browse files
authored
Merge branch 'Acode-Foundation:main' into codemirror
2 parents ec216b6 + 72cedfd commit 2beed42

File tree

4 files changed

+84
-47
lines changed

4 files changed

+84
-47
lines changed

src/lang/uk-ua.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@
215215
"no suggestions aggressive": "Без аґресивних пропозицій",
216216
"install": "Встановити",
217217
"installing": "Встановлення...",
218-
"plugins": "Втулки",
218+
"plugins": "Плагіни",
219219
"recently used": "Недавно використане",
220220
"update": "Оновити",
221221
"uninstall": "Видалити",
222222
"download acode pro": "Завантажити Acode pro",
223-
"loading plugins": "Loading plugins",
223+
"loading plugins": "Завантаження плагінів",
224224
"faqs": "FAQs",
225225
"feedback": "Feedback",
226226
"header": "Header",
@@ -340,7 +340,7 @@
340340
"search result": "{matches} results in {files} files.",
341341
"invalid regex": "Invalid regular expression: {message}.",
342342
"bottom": "Bottom",
343-
"save all": "Save all",
343+
"save all": "Зберегти все",
344344
"close all": "Close all",
345345
"unsaved files warning": "Some files are not saved. Click 'ok' select what to do or press 'cancel' to go back.",
346346
"save all warning": "Are you sure you want to save all files and close? This action cannot be reversed.",
@@ -353,8 +353,8 @@
353353
"quicktools:ctrl-key": "Control/Command key",
354354
"quicktools:tab-key": "Tab key",
355355
"quicktools:shift-key": "Shift key",
356-
"quicktools:undo": "Undo",
357-
"quicktools:redo": "Redo",
356+
"quicktools:undo": "Скасувати",
357+
"quicktools:redo": "Повторити",
358358
"quicktools:search": "Search in file",
359359
"quicktools:save": "Save file",
360360
"quicktools:esc-key": "Escape key",
@@ -382,7 +382,7 @@
382382
"info-quicktoolssettings": "Customize shortcut buttons and keyboard keys in the Quicktools container below the editor to enhance your coding experience.",
383383
"info-excludefolders": "Use the pattern **/node_modules/** to ignore all files from the node_modules folder. This will exclude the files from being listed and will also prevent them from being included in file searches.",
384384
"missed files": "Scanned {count} files after search started and will not be included in search.",
385-
"remove": "Remove",
385+
"remove": "Видалити",
386386
"quicktools:command-palette": "Command palette",
387387
"default file encoding": "Default file encoding",
388388
"remove entry": "Are you sure you want to remove '{name}' from the saved paths? Please note that removing it will not delete the path itself.",
@@ -391,7 +391,7 @@
391391
"reopen file": "Are you sure you want to reopen '{file}'? Any unsaved changes will be lost.",
392392
"plugin min version": "{name} only available in Acode - {v-code} and above. Click here to update.",
393393
"color preview": "Color preview",
394-
"confirm": "Confirm",
394+
"confirm": "Підтвердити",
395395
"list files": "List all files in <strong>{name}</strong>? Too many files may crash the app.",
396396
"problems": "Problems",
397397
"show side buttons": "Show side buttons",
@@ -435,7 +435,7 @@
435435
"terminal:cursor blink": "Cursor Blink",
436436
"terminal:font weight": "Font Weight",
437437
"terminal:cursor inactive style": "Cursor Inactive Style",
438-
"terminal:cursor style": "Cursor Style",
438+
"terminal:cursor style": "Стиль курсора",
439439
"terminal:font family": "Font Family",
440440
"terminal:convert eol": "Convert EOL",
441441
"terminal:confirm tab close": "Confirm terminal tab close",
@@ -455,7 +455,7 @@
455455
"author": "Author",
456456
"filtered by": "Filtered by",
457457
"clean install state": "Clean Install State",
458-
"backup created": "Backup created",
458+
"backup created": "Резервна копія створена",
459459
"restore completed": "Restore completed",
460460
"restore will include": "This will restore",
461461
"restore warning": "This action cannot be undone. Continue?",
@@ -475,7 +475,7 @@
475475
"plugin not found": "Plugin not found in registry",
476476
"paid plugin skipped": "Paid plugin - purchase not found",
477477
"source not found": "Source file no longer exists",
478-
"restored": "Restored",
478+
"restored": "Відновлено",
479479
"skipped": "Skipped",
480480
"backup not valid object": "Backup file is not a valid object",
481481
"backup no data": "Backup file contains no data to restore",
@@ -492,7 +492,7 @@
492492
"available tools": "Available tools",
493493
"recent": "Recent Files",
494494
"command palette": "Open Command Palette",
495-
"change theme": "Change Theme",
496-
"documentation": "Documentation",
497-
"open in terminal": "Open in Terminal"
495+
"change theme": "Змінити тему",
496+
"documentation": "Документація",
497+
"open in terminal": "Відкрити в терміналі"
498498
}

src/plugins/ftp/src/android/com/foxdebug/ftp/Ftp.java

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -595,24 +595,33 @@ public void run() {
595595

596596
ftp.setFileType(FTP.BINARY_FILE_TYPE);
597597

598-
InputStream inputStream = ftp.retrieveFileStream(path);
599-
if (inputStream == null) {
600-
Log.d(
601-
"FTP",
602-
"FTPClient (" + ftpId + ") path: " + path + " - not found"
603-
);
604-
callback.error("File not found.");
605-
return;
598+
// Delete existing cache file to prevent stale content
599+
if (localFile.exists()) {
600+
localFile.delete();
606601
}
607602

608-
FileOutputStream outputStream = new FileOutputStream(localFile);
609-
byte[] buffer = new byte[1024];
610-
int bytesRead = -1;
611-
while ((bytesRead = inputStream.read(buffer)) != -1) {
612-
outputStream.write(buffer, 0, bytesRead);
603+
try (
604+
InputStream inputStream = ftp.retrieveFileStream(path)
605+
) {
606+
if (inputStream == null) {
607+
Log.d(
608+
"FTP",
609+
"FTPClient (" + ftpId + ") path: " + path + " - not found"
610+
);
611+
callback.error("File not found.");
612+
return;
613+
}
614+
615+
try (
616+
FileOutputStream outputStream = new FileOutputStream(localFile)
617+
) {
618+
byte[] buffer = new byte[1024];
619+
int bytesRead = -1;
620+
while ((bytesRead = inputStream.read(buffer)) != -1) {
621+
outputStream.write(buffer, 0, bytesRead);
622+
}
623+
}
613624
}
614-
outputStream.close();
615-
inputStream.close();
616625

617626
if (!ftp.completePendingCommand()) {
618627
ftp.logout();
@@ -675,20 +684,22 @@ public void run() {
675684
ftp.setFileType(FTP.BINARY_FILE_TYPE);
676685

677686
Log.d("FTPUpload", "Destination " + remoteFilePath);
678-
OutputStream outputStream = ftp.storeFileStream(remoteFilePath);
679-
if (outputStream == null) {
680-
callback.error("File not found.");
681-
return;
682-
}
683687

684-
InputStream inputStream = new FileInputStream(localFile);
685-
byte[] buffer = new byte[1024];
686-
int bytesRead = -1;
687-
while ((bytesRead = inputStream.read(buffer)) != -1) {
688-
outputStream.write(buffer, 0, bytesRead);
688+
try (
689+
InputStream inputStream = new FileInputStream(localFile);
690+
OutputStream outputStream = ftp.storeFileStream(remoteFilePath)
691+
) {
692+
if (outputStream == null) {
693+
callback.error("File not found.");
694+
return;
695+
}
696+
697+
byte[] buffer = new byte[1024];
698+
int bytesRead = -1;
699+
while ((bytesRead = inputStream.read(buffer)) != -1) {
700+
outputStream.write(buffer, 0, bytesRead);
701+
}
689702
}
690-
outputStream.close();
691-
inputStream.close();
692703

693704
if (!ftp.completePendingCommand()) {
694705
ftp.logout();

src/plugins/sftp/src/com/foxdebug/sftp/Sftp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public void run() {
320320
try (
321321
InputStream inputStream = sftp.getInputStream(filename);
322322
java.io.OutputStream outputStream =
323-
contentResolver.openOutputStream(fileUri)
323+
contentResolver.openOutputStream(fileUri, "wt")
324324
) {
325325
byte[] buffer = new byte[32768];
326326
int bytesRead;

src/utils/polyfill.js

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,39 @@ export default function loadPolyFill() {
4747
if (!String.prototype.hashCode) {
4848
Object.defineProperty(String.prototype, "hashCode", {
4949
value: function () {
50-
let hash = 0;
51-
for (let i = 0; i < this.length; i++) {
52-
const chr = this.charCodeAt(i);
53-
hash = (hash << 5) - hash + chr;
54-
hash |= 0; // Convert to 32bit integer
50+
const str = this.toString();
51+
const len = str.length;
52+
53+
if (len === 0) return "0";
54+
55+
// Produces a 48-char hex string (192 bits)
56+
const FNV_PRIME = 0x01000193;
57+
const FNV_OFFSET = 0x811c9dc5;
58+
59+
// Generate 6 different 32-bit hashes with different seeds/offsets
60+
const hashes = [];
61+
for (let pass = 0; pass < 6; pass++) {
62+
let hash = FNV_OFFSET ^ (pass * 0x1234567);
63+
64+
for (let i = 0; i < len; i++) {
65+
const char = str.charCodeAt(i);
66+
// XOR with byte and multiply by prime
67+
hash ^= char;
68+
hash = Math.imul(hash, FNV_PRIME);
69+
// Mix in position and pass for additional entropy
70+
hash ^= (i + pass) & 0xff;
71+
hash = Math.imul(hash, FNV_PRIME);
72+
}
73+
74+
// Additional mixing
75+
hash ^= len;
76+
hash = Math.imul(hash, FNV_PRIME);
77+
hash ^= hash >>> 16;
78+
79+
hashes.push((hash >>> 0).toString(16).padStart(8, "0"));
5580
}
56-
return Math.abs(hash) + (hash < 0 ? "N" : "");
81+
82+
return hashes.join("");
5783
},
5884
});
5985
}

0 commit comments

Comments
 (0)