Skip to content

Commit 5f123c7

Browse files
authored
Fix/nc32 compatibility #1736 (#152)
* Documentation updated / Overlay fix NC32 ok - needs testing NC31 / Trying to fix button * Fix to the icon svg on NC32
1 parent bbe15d0 commit 5f123c7

File tree

5 files changed

+72
-9
lines changed

5 files changed

+72
-9
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This plugin integrates [Swarm](https://www.ethswarm.org/) (a decentralized, bloc
2121

2222
Before using the plugin, ensure you have the following:
2323

24-
- An active Nextcloud instance (version 30 or 31)
24+
- An active Nextcloud instance (version 30, 31 or 32)
2525
- A valid Access Key and URL to activate the service
2626
- [Get Your Free Trial for the Nextcloud Swarm Plugin](https://app.hejbit.com)
2727

@@ -49,14 +49,12 @@ Once installed, HejBit Swarm integrates directly with Nextcloud’s "Files" sect
4949

5050
Additionally, we have introduced a HejBit Feedback button that appears in the bottom left corner when you are inside a HejBit folder. This feature allows users to easily send feedback regarding general inquiries, ideas, or issues directly from the plugin.
5151

52-
5352
### Settings
5453

5554
Users with administrative credentials can configure the plugin through the standard External Storage settings. Here, you can input your Access Key and URL for HejBit Swarm.
5655

5756
![Basic HejBit Swarm setup in External Storage in Nextcloud administration](https://github.com/user-attachments/assets/3e80f664-86b9-4cfa-bbc5-6f9f1fbeb94a)
5857

59-
6058
### Usage
6159

6260
Once setup and configured, the Decentralized Storage is ready to use.

appinfo/info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This plugin integrates [Swarm](https://www.ethswarm.org/) (a decentralized, bloc
2626
2727
Before using the plugin, ensure you have the following:
2828
29-
- An active Nextcloud instance (version 30 or 31)
29+
- An active Nextcloud instance (version 30, 31 or 32)
3030
- A valid Access Key and URL to activate the service
3131
- [Get Your Free Trial for the Nextcloud Swarm Plugin](https://app.hejbit.com)
3232
@@ -104,7 +104,7 @@ This program is licensed under the AGPLv3 or later.
104104
<repository type="git">https://github.com/MetaProvide/nextcloud-swarm-plugin.git</repository>
105105
<screenshot>https://raw.githubusercontent.com/MetaProvide/nextcloud-swarm-plugin/main/assets/images/swarm_Files.png</screenshot>
106106
<dependencies>
107-
<nextcloud min-version="30" max-version="31"/>
107+
<nextcloud min-version="30" max-version="32"/>
108108
</dependencies>
109109
<settings>
110110
<admin>OCA\Files_External_Ethswarm\Settings\Admin</admin>

css/app.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,26 @@
77
pointer-events: none;
88
}
99

10+
.hejbit-overlay-32 {
11+
position: absolute;
12+
top: 23px;
13+
left: 60px;
14+
width: 16px;
15+
height: 16px;
16+
pointer-events: none;
17+
}
18+
1019
.hejbit-overlay svg {
1120
width: 16px;
1221
height: 16px;
1322
}
1423

24+
.hejbit-overlay-32 svg {
25+
width: 16px;
26+
height: 16px;
27+
}
28+
29+
1530
.hejbit-archive svg {
1631
filter: grayscale(100%);
1732
border: 1px dashed #f6c915;

img/hejbit-logo-padded.svg

Lines changed: 31 additions & 0 deletions
Loading

src/app/files/actions/overlay.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import { FileAction, registerFileAction } from "@nextcloud/files";
22
import { showInfo } from "@nextcloud/dialogs";
33
import HejBitSvg from "@/../img/hejbit-logo.svg";
4+
import HejBitPaddedSvg from "@/../img/hejbit-logo-padded.svg";
45
import InfoSvg from "@material-design-icons/svg/filled/info.svg";
56
import FilesHelper from "@/util/FilesHelper";
67
import SvgHelper from "@/util/SvgHelper";
8+
import { loadState } from '@nextcloud/initial-state';
9+
10+
711

812
registerFileAction(
913
new FileAction({
@@ -29,24 +33,39 @@ registerFileAction(
2933
},
3034

3135
iconSvgInline(files, view) {
32-
return SvgHelper.convert(
33-
FilesHelper.isArchiveFolder(files) ? InfoSvg : HejBitSvg
34-
);
36+
const config = loadState('core', 'config');
37+
const majorVersion = config?.version ? parseInt(config.version.split('.')[0]) : null;
38+
if (majorVersion === 32){
39+
return SvgHelper.convert(FilesHelper.isArchiveFolder(files) ? InfoSvg : HejBitPaddedSvg);
40+
}else{
41+
return SvgHelper.convert(FilesHelper.isArchiveFolder(files) ? InfoSvg : HejBitSvg);
42+
}
43+
3544
},
3645

3746
inline(file, view) {
3847
return true;
3948
},
4049

4150
async renderInline(node, view) {
51+
52+
const config = loadState('core', 'config');
53+
const majorVersion = config?.version ? parseInt(config.version.split('.')[0]) : null;
54+
4255
// Create the overlay element
4356
const overlay = document.createElement("div");
44-
overlay.classList.add("hejbit-overlay");
57+
58+
if (majorVersion === 32) {
59+
overlay.classList.add("hejbit-overlay-32");
60+
} else {
61+
overlay.classList.add("hejbit-overlay");
62+
}
4563

4664
if (FilesHelper.isArchive(node)) {
4765
overlay.classList.add("hejbit-archive");
4866
}
4967

68+
5069
overlay.innerHTML = SvgHelper.convert(HejBitSvg);
5170

5271
return overlay;

0 commit comments

Comments
 (0)