Skip to content

Commit 60e266b

Browse files
NC 33 Upgrdaes for JS (#158)
* fix: fileactions * fix: upgrade dialogs to v7 * fix: stream upload tmp * fix: overlay icon * chore: fix code style * fix: padded icon * fix: icon * chore: update deploy script version * feat: bump plugin version to 32 and 33 * feat: setup node on deploy script * feat: change ci pipeline for new infra setup * fix: deploy script * documentation update * chore: set dev env example to 33 * WIP - NC 32 compatabilty * fix: compatibility issues with NC32 and NC33 * chore: add adminer to development profile * chore: fix to files v4 * chore: fix code style --------- Co-authored-by: mahiarirani <10583381+mahiarirani@users.noreply.github.com> Co-authored-by: JoaoSRaposo <joaosraposo@gmail.com>
1 parent 1cffca3 commit 60e266b

24 files changed

Lines changed: 2622 additions & 936 deletions

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ENV=development
2-
NC_VERSION=31
2+
NC_VERSION=33
33
APP_URL=localhost
44
API_URL=https://hejbit.local
55

.github/workflows/staging.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
uses: appleboy/ssh-action@master
1818
with:
1919
host: ${{ vars.STAGING_SERVER_HOST }}
20-
username: deploy
20+
username: ${{ vars.STAGING_SERVER_USER }}
2121
key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }}
22+
proxy_host: ${{ vars.STAGING_PROXY_HOST }}
23+
proxy_username: ${{ vars.STAGING_PROXY_USER }}
24+
proxy_key: ${{ secrets.STAGING_PROXY_SSH_PRIVATE_KEY }}
2225
script: bash deploy

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ js/nextcloud-swarm-plugin*.*
1111

1212
# IDE
1313
.idea
14+
.history
1415

1516
# OS
1617
.DS_Store

README.md

Lines changed: 1 addition & 1 deletion
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 31 or 32)
24+
- An active Nextcloud instance (version 32 or 33)
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

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 31 or 32)
29+
- An active Nextcloud instance (version 32 or 33)
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="31" max-version="32"/>
107+
<nextcloud min-version="32" max-version="33"/>
108108
</dependencies>
109109
<settings>
110110
<admin>OCA\Files_External_Ethswarm\Settings\Admin</admin>

cli/staging/deploy.sh

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ action() {
6464

6565
deploy() {
6666
local version=$1
67-
cd hejbit-"$version" || failed "hejbit-$version not found"
67+
cd "/opt/hejbit/hejbit-$version" || failed "$version" "/opt/hejbit/hejbit-$version not found"
6868

6969
buffer "$(log_note "deploying hejbit-$version")"
7070

@@ -85,6 +85,24 @@ sync_code() {
8585
git pull 2>&1 || return 1
8686
}
8787

88+
setup_node() {
89+
command -v npm > /dev/null 2>&1 && return 0
90+
91+
export NVM_DIR="$HOME/.nvm"
92+
if [ -s "$NVM_DIR/nvm.sh" ]; then
93+
. "$NVM_DIR/nvm.sh"
94+
95+
NODE_20_VERSION=$(nvm version 20 2> /dev/null)
96+
if [ "$NODE_20_VERSION" != "N/A" ]; then
97+
nvm use --silent "$NODE_20_VERSION" > /dev/null 2>&1 || return 1
98+
else
99+
nvm use --silent default > /dev/null 2>&1 || return 1
100+
fi
101+
fi
102+
103+
command -v npm > /dev/null 2>&1 || return 1
104+
}
105+
88106
build_app() {
89107
result=$(npm install 2>&1)
90108
status=$?
@@ -114,24 +132,19 @@ nextcloud_upgrade() {
114132
}
115133

116134
cd /opt/hejbit || log_error "/opt/hejbit not found"
135+
136+
if ! setup_node; then
137+
log_error "npm not found for user $(whoami)"
138+
log_error "install node/npm or configure nvm default"
139+
exit 1
140+
fi
141+
117142
log_note "deploying hejbit to staging"
118143
log_gap
119144

120-
DEPLOYMENT=()
121145
TIMESTAMP=$(date +%s)
122-
for version in {30..32}; do
123-
deploy "$version" &
124-
DEPLOYMENT+=($!)
125-
done
126-
127-
statuses=0
128-
for pid in "${DEPLOYMENT[@]}"; do
129-
wait "$pid"
130-
statuses+=$?
146+
for version in {32..33}; do
147+
deploy "$version"
131148
done
132149

133-
if [ $statuses -ne 0 ]; then
134-
log_error "failed to deploy hejbit to staging"
135-
exit 1
136-
fi
137150
log_success "deployed hejbit to staging"

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/app.css

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
.hejbit-overlay {
2-
position: absolute;
3-
top: 30px;
4-
left: 75px;
5-
width: 16px;
6-
height: 16px;
7-
pointer-events: none;
8-
}
9-
10-
.hejbit-overlay-32 {
112
position: absolute;
123
top: 23px;
134
left: 60px;
@@ -21,11 +12,6 @@
2112
height: 16px;
2213
}
2314

24-
.hejbit-overlay-32 svg {
25-
width: 16px;
26-
height: 16px;
27-
}
28-
2915

3016
.hejbit-archive svg {
3117
filter: grayscale(100%);

docker-compose.yml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,34 @@ services:
105105
networks:
106106
- backend
107107

108-
adminer: # visit https://adminer.hejbit.local/?pgsql=postgres&username=swarmbox&db=swarmbox
108+
rsync:
109+
build:
110+
context: ./docker/rsync
111+
dockerfile: Dockerfile
112+
restart: unless-stopped
113+
cpu_shares: 512
114+
mem_limit: 256m
115+
volumes:
116+
- nc-app:/app:ro
117+
- ./dev-environment/nextcloud_source:/source
118+
environment:
119+
- RSYNC_CRONTAB=crontab
120+
depends_on:
121+
- nextcloud
122+
networks:
123+
- backend
124+
125+
adminer:
126+
profiles:
127+
- development
128+
# visit https://adminer.hejbit.local/?pgsql=postgres&username=swarmbox&db=swarmbox
109129
image: adminer:latest
110130
restart: unless-stopped
111131
# ports:
112132
# - '8080:8080'
113133
networks:
114134
- backend
115135
- proxy
116-
117136
depends_on:
118137
postgres:
119138
condition: service_healthy
@@ -125,24 +144,9 @@ services:
125144
environment:
126145
ADMINER_DEFAULT_SERVER: postgres
127146

128-
rsync:
129-
build:
130-
context: ./docker/rsync
131-
dockerfile: Dockerfile
132-
restart: unless-stopped
133-
cpu_shares: 512
134-
mem_limit: 256m
135-
volumes:
136-
- nc-app:/app:ro
137-
- ./dev-environment/nextcloud_source:/source
138-
environment:
139-
- RSYNC_CRONTAB=crontab
140-
depends_on:
141-
- nextcloud
142-
networks:
143-
- backend
144-
145147
flagd:
148+
profiles:
149+
- feature
146150
image: ghcr.io/open-feature/flagd:latest
147151
restart: unless-stopped
148152
command: 'start --uri file:/etc/flagd/hejbit.flagd.json --cors-origin *'
@@ -158,10 +162,10 @@ services:
158162
depends_on:
159163
proxy:
160164
condition: service_healthy
161-
profiles:
162-
- feature
163165

164166
onlyoffice:
167+
profiles:
168+
- onlyoffice
165169
image: onlyoffice/documentserver
166170
environment:
167171
JWT_ENABLED: true
@@ -186,8 +190,6 @@ services:
186190
depends_on:
187191
proxy:
188192
condition: service_healthy
189-
profiles:
190-
- onlyoffice
191193

192194
proxy:
193195
image: lucaslorentz/caddy-docker-proxy:alpine
@@ -220,6 +222,7 @@ volumes:
220222
onlyoffice_lib:
221223
onlyoffice_logs:
222224

225+
223226
networks:
224227
frontend:
225228
backend:

lib/Storage/BeeSwarm.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use OC;
2727
use OC\Files\Cache\Cache;
2828
use OC\Files\Storage\Common;
29-
use OC_Helper;
3029
use OCA\Files_External_Ethswarm\AppInfo\Application;
3130
use OCA\Files_External_Ethswarm\Db\SwarmFile;
3231
use OCA\Files_External_Ethswarm\Db\SwarmFileMapper;
@@ -515,7 +514,7 @@ protected function createTempFile($stream): string {
515514
$extension = '';
516515
$tmpFile = $this->tempManager->getTemporaryFile($extension);
517516
$target = fopen($tmpFile, 'w');
518-
OC_Helper::streamCopy($stream, $target);
517+
stream_copy_to_stream($stream, $target);
519518
fclose($target);
520519

521520
return $tmpFile;

0 commit comments

Comments
 (0)