Skip to content

Commit 9c06c59

Browse files
authored
Patch plugin page issues (#1200)
* fix: infinite scroll while searching * fix: plugin page issue in some cases - handle if changelogs not available - rename changelog to changelogs - handle weird keywords type * feat: add option to install plugins from sidebar
1 parent dc69d7d commit 9c06c59

File tree

5 files changed

+141
-85
lines changed

5 files changed

+141
-85
lines changed

CHANGELOG.md

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,67 @@
22

33
## v1.11.0 (956)
44

5-
### Fixes
6-
* Fixed a typo: "vission" → "vision" by @ByteJoseph in #1125
7-
* Fixed heading and image alignment issues with `alignment="center"` on the plugin page by @bajrangCoder in #1132
8-
* Fixed file listing in SFTP by @bajrangCoder in #1133
9-
* Fixed fallback to `*/*` when the `accept` attribute is absent in `<input type="file">` in the in-app browser by @bajrangCoder in #1154
10-
* Fixed console not reappearing after page reload in the in-app browser by @bajrangCoder in #1155
11-
* Fixed infinite scroll on the plugin page to remove duplicates by @bajrangCoder in #1171
12-
* Fixed logger to limit its size in #1167
13-
* Fixed an issue where the info dialog wouldn't appear for non-editor tabs in #1167
14-
* Fixed incorrect file attributes in FTP by @bajrangCoder in #1194
15-
* Fixed the palette not opening when triggered from an existing palette by @bajrangCoder in #1197
16-
17-
### Features
18-
* Improved tab view gesture handling to distinguish between scroll and swipe on the plugin page by @bajrangCoder in #1131
19-
* Added color preview for SVG files by @bajrangCoder in #1135
20-
* Implemented custom editor tab support by @bajrangCoder in #1136
21-
* Now supports image, video, and audio previews directly in the editor instead of pop-ups
22-
* Exposed API for plugin developers to add content in editor tabs via `EditorFile`
23-
* Redesigned the About page by @bajrangCoder in #1153
24-
* Added a plugin rebuild option for local plugins by @bajrangCoder in #1150
25-
* Plugins can use `cordova.plugin.http` instead of `fetch` to avoid CORS issues when making network requests
26-
* Redesigned the Plugin page by @bajrangCoder in #1152
27-
* Added new metadata fields in `plugin.json`: `license`, `changelog`, `keywords`, and `contributors`
28-
* Added a new option to open files in an external app from the file browser in #1163
29-
* Added minor sidebar UI tweaks and improved input element styling in #1164
30-
* Used theme colors in the extra cutout area in landscape mode instead of the default color in #1165
31-
* Improved file info dialog design in #1170
32-
* Added Eruda console support for external sites in Acode's built-in browser in #1172
33-
* Added a new editor setting: **"Fade fold widgets"** by @bajrangCoder in #1195
34-
* Added a command to change the editor and app theme via the command palette by @bajrangCoder in #1197
35-
36-
### Improvements
37-
* Improved paste operation with proper error handling in #1162
38-
* Rewritten SFTP implementation(#1167):
39-
* Better performance and stability
40-
* Improved symlink support with better visual distinction
41-
* Proper error handling
42-
* Enhanced file reading (downloading) and writing
43-
* Uses native APIs for file system operations
44-
* Better buffer handling—now even 30-40 minute videos load within seconds (faster than internal storage)
45-
* Emoji support added
46-
* Improved the FTP client (#1193) by @bajrangCoder
47-
* Supports emoji-named files
48-
* Improved symlink handling
49-
* Better handling of videos and images as binary files
50-
* Displays file names instead of full paths
51-
* Reworked the plugin page UI—now displays essential info such as author, license, price, etc., in the list view by @bajrangCoder in #1196
52-
* Tweaked breadcrumbs in the file browser to follow the app theme in #1167
53-
* Updated the SSH library to `v3.1.2` in #1167
54-
* Removed deprecated APIs in #1167
55-
* Added experimental support for saving native logs in Acode Logger in #1167
5+
### Fixes
6+
* Fixed a typo: "vission" → "vision" by @ByteJoseph in #1125
7+
* Fixed heading and image alignment issues with `alignment="center"` on the plugin page by @bajrangCoder in #1132
8+
* Fixed file listing in SFTP by @bajrangCoder in #1133
9+
* Fixed fallback to `*/*` when the `accept` attribute is absent in `<input type="file">` in the in-app browser by @bajrangCoder in #1154
10+
* Fixed console not reappearing after page reload in the in-app browser by @bajrangCoder in #1155
11+
* Fixed infinite scroll on the plugin page to remove duplicates by @bajrangCoder in #1171
12+
* Fixed logger to limit its size in #1167
13+
* Fixed an issue where the info dialog wouldn't appear for non-editor tabs in #1167
14+
* Fixed incorrect file attributes in FTP by @bajrangCoder in #1194
15+
* Fixed the palette not opening when triggered from an existing palette by @bajrangCoder in #1197
16+
* Fixed trigering of infinite scroll on plugin page while searching by @bajrangCoder in #1200
17+
18+
### Features
19+
* Improved tab view gesture handling to distinguish between scroll and swipe on the plugin page by @bajrangCoder in #1131
20+
* Added color preview for SVG files by @bajrangCoder in #1135
21+
* Implemented custom editor tab support by @bajrangCoder in #1136
22+
* Now supports image, video, and audio previews directly in the editor instead of pop-ups
23+
* Exposed API for plugin developers to add content in editor tabs via `EditorFile`
24+
* Redesigned the About page by @bajrangCoder in #1153
25+
* Added a plugin rebuild option for local plugins by @bajrangCoder in #1150
26+
* Plugins can use `cordova.plugin.http` instead of `fetch` to avoid CORS issues when making network requests
27+
* Redesigned the Plugin page by @bajrangCoder in #1152
28+
* Added new metadata fields in `plugin.json`: `license`, `changelog`, `keywords`, and `contributors`
29+
* Added a new option to open files in an external app from the file browser in #1163
30+
* Added minor sidebar UI tweaks and improved input element styling in #1164
31+
* Used theme colors in the extra cutout area in landscape mode instead of the default color in #1165
32+
* Improved file info dialog design in #1170
33+
* Added Eruda console support for external sites in Acode's built-in browser in #1172
34+
* Added a new editor setting: **"Fade fold widgets"** by @bajrangCoder in #1195
35+
* Added a command to change the editor and app theme via the command palette by @bajrangCoder in #1197
36+
* Added option to install plugins directly from sidebar extensions app by @bajrangCoder in #1200
37+
38+
### Improvements
39+
* Improved paste operation with proper error handling in #1162
40+
* Rewritten SFTP implementation(#1167):
41+
* Better performance and stability
42+
* Improved symlink support with better visual distinction
43+
* Proper error handling
44+
* Enhanced file reading (downloading) and writing
45+
* Uses native APIs for file system operations
46+
* Better buffer handling—now even 30-40 minute videos load within seconds (faster than internal storage)
47+
* Emoji support added
48+
* Improved the FTP client (#1193) by @bajrangCoder
49+
* Supports emoji-named files
50+
* Improved symlink handling
51+
* Better handling of videos and images as binary files
52+
* Displays file names instead of full paths
53+
* Reworked the plugin page UI—now displays essential info such as author, license, price, etc., in the list view by @bajrangCoder in #1196
54+
* Tweaked breadcrumbs in the file browser to follow the app theme in #1167
55+
* Updated the SSH library to `v3.1.2` in #1167
56+
* Removed deprecated APIs in #1167
57+
* Added experimental support for saving native logs in Acode Logger in #1167
5658
* Tweaked the donation page #1188
5759

58-
### Other Changes
60+
### Other Changes
5961
* **Chore**: Updated Ace Editor to `v1.39.0`
6062
* Added CSV & TSV mode
6163
* Improved search support for multi-line patterns (`\n`, `\t`)
6264
* And more—see the Ace Changelog
63-
* Many translation updates for `hu-hu` by @summoner
65+
* Many translation updates for `hu-hu` by @summoner
6466

6567
## v1.10.7 (955)
6668

src/pages/plugin/plugin.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,19 @@ export default async function PluginInclude(
7979
const description = await fsOperation(
8080
Url.join(PLUGIN_DIR, id, "readme.md"),
8181
).readFile("utf8");
82-
const changelog = installedPlugin.changelog
83-
? await fsOperation(
84-
Url.join(PLUGIN_DIR, id, installedPlugin.changelog),
85-
).readFile("utf8")
86-
: "";
82+
let changelogs = "";
83+
if (installedPlugin.changelogs) {
84+
const changelogPath = Url.join(
85+
PLUGIN_DIR,
86+
id,
87+
installedPlugin.changelogs,
88+
);
89+
const changelogExists = await fsOperation(changelogPath).exists();
90+
if (changelogExists) {
91+
changelogs = await fsOperation(changelogPath).readFile("utf8");
92+
}
93+
}
94+
8795
const iconUrl = await helpers.toInternalUri(
8896
Url.join(PLUGIN_DIR, id, "icon.png"),
8997
);
@@ -103,7 +111,7 @@ export default async function PluginInclude(
103111
keywords: installedPlugin.keywords,
104112
contributors: installedPlugin.contributors,
105113
description,
106-
changelog,
114+
changelogs,
107115
};
108116

109117
isPaid = installedPlugin.price > 0;
@@ -153,7 +161,7 @@ export default async function PluginInclude(
153161
}
154162
}
155163
} catch (error) {
156-
window.log("error", error);
164+
console.log(error);
157165
} finally {
158166
loader.removeTitleLoader();
159167
}
@@ -167,7 +175,7 @@ export default async function PluginInclude(
167175
$button?.click();
168176
}
169177
} catch (err) {
170-
window.log("error", err);
178+
console.log(err);
171179
helpers.error(err);
172180
} finally {
173181
loader.removeTitleLoader();
@@ -311,7 +319,7 @@ export default async function PluginInclude(
311319
})
312320
.use(markdownItTaskLists)
313321
.render(plugin.description),
314-
changelog: plugin.changelog
322+
changelogs: plugin.changelogs
315323
? markdownIt({ html: true, xhtmlOut: true })
316324
.use(MarkdownItGitHubAlerts)
317325
.use(anchor, {
@@ -322,7 +330,7 @@ export default async function PluginInclude(
322330
.replace(/[^a-z0-9]+/g, "-"),
323331
})
324332
.use(markdownItTaskLists)
325-
.render(plugin.changelog)
333+
.render(plugin.changelogs)
326334
: null,
327335
purchased,
328336
installed,

src/pages/plugin/plugin.view.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import TabView from "components/tabView";
22
import toast from "components/toast";
33
import alert from "dialogs/alert";
4+
import DOMPurify from "dompurify";
45
import fsOperation from "fileSystem";
56
import Ref from "html-tag-js/ref";
67
import actionStack from "lib/actionStack";
78
import constants from "lib/constants";
89
import Url from "utils/Url";
910
import helpers from "utils/helpers";
11+
1012
export default (props) => {
1113
const {
1214
id,
@@ -18,7 +20,7 @@ export default (props) => {
1820
license,
1921
keywords,
2022
contributors,
21-
changelog,
23+
changelogs,
2224
votes_up: votesUp,
2325
votes_down: votesDown,
2426
author_verified: authorVerified,
@@ -101,7 +103,7 @@ export default (props) => {
101103
</div>
102104
</div>
103105
) : null}
104-
{keywords?.length ? (
106+
{Array.isArray(keywords) && keywords.length ? (
105107
<div className="keywords">
106108
{keywords.map((keyword) => (
107109
<span className="keyword">{keyword}</span>
@@ -163,28 +165,24 @@ export default (props) => {
163165
})()}
164166
</div>
165167

166-
<div id="changelog" className="content-section">
167-
{changelog || (
168-
<div className="no-changelog">
169-
<i className="icon historyrestore"></i>
170-
<p
171-
style={{
172-
fontSize: "1.1rem",
173-
}}
174-
>
168+
<div
169+
id="changelog"
170+
className="content-section md"
171+
innerHTML={
172+
DOMPurify.sanitize(changelogs) ||
173+
`
174+
<div class="no-changelog">
175+
<i class="icon historyrestore"></i>
176+
<p style="font-size: 1.1rem;">
175177
No changelog is available for this plugin yet.
176178
</p>
177-
<p
178-
style={{
179-
fontSize: "0.9rem",
180-
fontStyle: "italic",
181-
}}
182-
>
179+
<p style="font-size: 0.9rem; font-style: italic;">
183180
Check back later for updates!
184181
</p>
185182
</div>
186-
)}
187-
</div>
183+
`
184+
}
185+
></div>
188186
</div>
189187
</TabView>
190188
</div>

src/pages/plugins/plugins.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function PluginsInclude(updates) {
4747
let currentPage = 1;
4848
let isLoading = false;
4949
let hasMore = true;
50+
let isSearching = false;
5051
const LIMIT = 50;
5152

5253
Contextmenu({
@@ -147,7 +148,7 @@ export default function PluginsInclude(updates) {
147148
$page.onclick = handleClick;
148149

149150
$list.all.addEventListener('scroll', async (e) => {
150-
if (isLoading || !hasMore) return;
151+
if (isLoading || !hasMore || isSearching) return;
151152

152153
const { scrollTop, scrollHeight, clientHeight } = e.target;
153154
if (scrollTop + clientHeight >= scrollHeight - 100) {
@@ -187,15 +188,23 @@ export default function PluginsInclude(updates) {
187188
const { action } = $target.dataset;
188189
if (action === "search") {
189190
if (currSection === "all") {
191+
isSearching = true;
190192
searchBar(
191193
$currList,
192-
(hide) => (hideSearchBar = hide),
194+
(hide) => {
195+
hideSearchBar = hide;
196+
isSearching = false;
197+
},
193198
undefined,
194199
searchRemotely,
195200
);
196201
return;
197202
} else {
198-
searchBar($currList, (hide) => (hideSearchBar = hide));
203+
isSearching = true;
204+
searchBar($currList, (hide) => {
205+
hideSearchBar = hide;
206+
isSearching = false;
207+
});
199208
return;
200209
}
201210
}
@@ -398,6 +407,7 @@ export default function PluginsInclude(updates) {
398407
await installPlugin(source);
399408
await getInstalledPlugins();
400409
} catch (error) {
410+
console.error(error);
401411
window.toast(helpers.errorMessage(error));
402412
addSource(sourceType, source);
403413
}

src/sidebarApps/extensions/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import "./style.scss";
22

33
import collapsableList from "components/collapsableList";
44
import Sidebar from "components/sidebar";
5+
import prompt from "dialogs/prompt";
56
import select from "dialogs/select";
67
import fsOperation from "fileSystem";
78
import constants from "lib/constants";
89
import InstallState from "lib/installState";
910
import settings from "lib/settings";
11+
import FileBrowser from "pages/fileBrowser";
1012
import plugin from "pages/plugin";
1113
import Url from "utils/Url";
1214
import helpers from "utils/helpers";
@@ -32,6 +34,9 @@ const $header = (
3234
<button className="icon-button" onclick={filterPlugins}>
3335
<span className="icon tune"></span>
3436
</button>
37+
<button className="icon-button" onclick={addSource}>
38+
<span className="icon more_vert"></span>
39+
</button>
3540
</div>
3641
<input
3742
oninput={searchPlugin}
@@ -215,6 +220,39 @@ async function clearFilter() {
215220
$searchResult.content = "";
216221
}
217222

223+
async function addSource() {
224+
const sourceOption = [
225+
["remote", strings.remote],
226+
["local", strings.local],
227+
];
228+
const sourceType = await select("Select Source", sourceOption);
229+
230+
if (!sourceType) return;
231+
let source;
232+
if (sourceType === "remote") {
233+
source = await prompt("Enter plugin source", "https://", "url");
234+
} else {
235+
source = (await FileBrowser("file", "Select plugin source")).url;
236+
}
237+
238+
if (!source) return;
239+
240+
try {
241+
const { default: installPlugin } = await import("lib/installPlugin");
242+
await installPlugin(source);
243+
if (!$explore.collapsed) {
244+
$explore.ontoggle();
245+
}
246+
if (!$installed.collapsed) {
247+
$installed.ontoggle();
248+
}
249+
} catch (error) {
250+
console.error(error);
251+
window.toast(helpers.errorMessage(error));
252+
addSource(sourceType, source);
253+
}
254+
}
255+
218256
async function loadInstalled() {
219257
if (this.collapsed) return;
220258

0 commit comments

Comments
 (0)