Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,28 @@ on:
workflow_call:

env:
OCIS_URL: https://localhost:9200
OC_URL: https://localhost:9200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is for both, why not keep OCIS_URL as env too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OC_URL serves for both

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because one of the servers is not called OCIS ;-)


jobs:
lint-and-tests:
strategy:
matrix:
server:
- Ocis
- Opencloud
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: generate-package-json
run: make dependencies${{ matrix.server }}

- name: pnpm-install
uses: pnpm/action-setup@v4
with:
run_install: |
- args: [--frozen-lockfile, --strict-peer-dependencies]

- name: install
run: make install${{ matrix.server }}

- name: lint
run: pnpm lint
Expand All @@ -45,10 +53,11 @@ jobs:
run: pnpm test:unit --coverage

- name: ocis-server
if: matrix.server == 'Ocis'
run: |
docker run --rm -d \
-p 9200:9200 \
-e OCIS_URL=$OCIS_URL \
-e OCIS_URL=$OC_URL \
-e OCIS_INSECURE=true \
-e OCIS_LOG_LEVEL=error \
-e IDM_ADMIN_PASSWORD=admin \
Expand All @@ -61,6 +70,24 @@ jobs:
owncloud/ocis-rolling:latest \
-c 'ocis init || true && ocis server'

- name: opencloud-server
if: matrix.server == 'Opencloud'
run: |
docker run --rm -d \
-p 9200:9200 \
-e OC_URL=$OC_URL \
-e OC_INSECURE=true \
-e OC_LOG_LEVEL=error \
-e IDM_ADMIN_PASSWORD=admin \
-e PROXY_ENABLE_BASIC_AUTH=true \
-e PROXY_CSP_CONFIG_FILE_LOCATION=/etc/opencloud/csp.yml \
-e WEB_ASSET_APPS_PATH=/web/apps \
-v ${{ github.workspace }}/dev/config/csp.yml:/etc/opencloud/csp.yml:ro \
-v ${{ github.workspace }}/dist:/web/apps:ro \
--entrypoint sh \
opencloudeu/opencloud-rolling:latest \
-c 'opencloud init || true && opencloud server'

- name: host-ip
id: host_ip
run: echo "host_ip=$(hostname -I | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:

- name: create-artifacts
run: |
(cd dist && zip -r - .) >mdpresentation-viewer-${{ github.ref_name }}.zip
(cd dist && zip -r - .) >mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip
mkdir -p dist/release
mv mdpresentation-viewer-${{ github.ref_name }}.zip dist/release/
md5sum dist/release/mdpresentation-viewer-${{ github.ref_name }}.zip >dist/release/md5sum.txt
sha256sum dist/release/mdpresentation-viewer-${{ github.ref_name }}.zip >dist/release/sha256sum.txt
mv mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip dist/release/
md5sum dist/release/mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip >dist/release/md5sum.txt
sha256sum dist/release/mdpresentation-viewer-${{ matrix.server }}-${{ github.ref_name }}.zip >dist/release/sha256sum.txt

- name: publish-artifacts
uses: fnkr/github-action-ghr@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
dist
coverage
pnpm-lock.yaml

# Editor directories and files
.vscode
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM owncloudci/nodejs:20 AS stage
ARG server=Ocis

WORKDIR /extension

COPY . .
RUN pnpm install
RUN make install$server
RUN pnpm build

FROM alpine:3.20
WORKDIR /app
COPY --from=stage /extension/dist ./
COPY --from=stage /extension/dist ./
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.PHONY: installOcis installOpencloud dependenciesOcis dependenciesOpencloud install clean package

installOcis: dependenciesOcis install

installOpencloud: dependenciesOpencloud install

dependenciesOcis: clean
$(MAKE) package PACKAGE_JSON=package-ocis.json
$(MAKE) depencenciesReplacement SOURCE=opencloud-eu DEST=ownclouders

dependenciesOpencloud: clean
$(MAKE) package PACKAGE_JSON=package-opencloud.json
$(MAKE) depencenciesReplacement SOURCE=ownclouders DEST=opencloud-eu

package:
jq -s '.[0] * .[1]' package-common.json $(PACKAGE_JSON) > package.json

depencenciesReplacement:
find . -type f \( -name "*.ts" -o -name "*.vue" -o -name "*.prettierrc" \) -not \( -path "./node_modules/*" -o -path "./dist/*" \) -print0 | xargs -0 sed -i 's/${SOURCE}/${DEST}/g'

clean:
rm -f package.json
rm -rf dist
rm -f pnpm-lock.yaml

install:
pnpm install
68 changes: 44 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![cover photo](./images/cover-large.png)

A markdown presentation viewer for [ownCloud web](https://github.com/owncloud/web/) (the webUI of [oCIS](https://github.com/owncloud/ocis/)) using the [reveal.js](https://revealjs.com/) library.
A markdown presentation viewer for [OpenCloud](https://github.com/opencloud-eu/opencloud/) and [oCIS](https://github.com/owncloud/ocis/) using the [reveal.js](https://revealjs.com/) library.

It allows users to:

Expand All @@ -11,42 +11,35 @@ It allows users to:

## Demonstration

- [Demonstation page](https://ocis.in-nepal.de/com.github.jankaritech.mdpresentation-viewer/public/phDIUqntYOMSfcE/presentation.md)
- [Demonstation page OpenCloud](https://opencloud.in-nepal.de/files/link/public/PHxkrAlpSRaqNNK)
- [Demonstation page oCIS](https://ocis.in-nepal.de/files/link/public/phDIUqntYOMSfcE)
- Click on `Open in Presentation Viewer` to view the slides

## Supported oCIS and Web Versions

- [oCIS](https://github.com/owncloud/ocis) (>= 6.x.x)
- [Web](https://nodejs.org/en/) (>= 9.x.x)
- [oCIS](https://github.com/owncloud/ocis) (>= 6.x.x) or [OpenCloud](https://github.com/opencloud-eu/opencloud/) (>= 2.0.0)

## App Installation

> NOTE: Requires oCIS >= 6.0.0

1. Download the zip file from the [releases page](https://github.com/JankariTech/web-app-presentation-viewer/releases)

For example: `mdpresentation-viewer-x.x.x.zip`
For example: `mdpresentation-viewer-<architecture>-x.x.x.zip`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it be arch or server name?

Suggested change
For example: `mdpresentation-viewer-<architecture>-x.x.x.zip`
For example: `mdpresentation-viewer-<server>-x.x.x.zip`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed it to use server everywhere. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server sounds good. here as well


2. Extract the zip file to the `apps` directory of the oCIS server.
2. Extract the zip file to the `apps` directory of the OpenCloud/oCIS server.

Apps directory is set using the `WEB_ASSET_APPS_PATH` environment variable.

### App Installation With [oCIS Deployment](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full)
### App Installation With [OpenCloud](https://github.com/opencloud-eu/opencloud/tree/main/deployments/examples/opencloud_full) or [oCIS Deployment](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full)

1. Copy [`deployments/mdpresentation-viewer.yml`](./deployments/mdpresentation-viewer.yml) into the [web_extensions](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full/web_extensions)
subfolder of oCIS full deployment example.
2. Add `MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer.yml` to the `## oCIS Web Extensions ##` section of the `.env` file of your installation (file is located in `deployments/examples/ocis_full`) and append it to the `COMPOSE_FILE` variable.
1. Copy the `yml` file that corresponds with your server (OpenCloud or oCIS) from [`deployments/`](./deployments/) into the `web_extensions`
subfolder.
2. Add `MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer-<your-server>.yml` to the `Web Extensions` section of the `.env` file of your installation and append it to the `COMPOSE_FILE` variable.
```env
## oCIS Web Extensions ##
MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer.yml
MDPRESENTATION_VIEWER=:web_extensions/mdpresentation-viewer-<your-server>.yml

COMPOSE_FILE=docker-compose.yml${...}${MDPRESENTATION_VIEWER:-}
```
3. Run `docker compose up` to run oCIS with the extensions

oCIS URL: [ocis.owncloud.test](https://ocis.owncloud.test)

See the [docs](https://github.com/owncloud/ocis/tree/master/deployments/examples/ocis_full).
3. Run `docker compose up` to run the server with the extensions

## Creating Presentation

Expand All @@ -59,16 +52,26 @@ This app has the following default slide separators:

## Development

> [!IMPORTANT] When switching between OpenCloud and oCIS, make sure to clean the browser cache!
> [!CAUTION] Before commiting changes run `make installOcis` and `make clean`

#### Prerequisites

- [Node.js `v18`](https://nodejs.org/en/)
- [pnpm `v8`](https://pnpm.io/)
- [Docker Compose](https://docs.docker.com/compose/)
- [jq](https://jqlang.org/)

#### 1. Install dependencies:

For OpenCloud:
```bash
pnpm install
make installOpencloud
```

For oCIS:
```bash
make installOcis
```

#### 2. Build the extension
Expand All @@ -81,12 +84,29 @@ pnpm build:w

#### 3. Load the extension

> NOTE: Requires oCIS >= 6.0.0
Run the server with the extension:

Run the oCIS server:
For OpenCloud:
```bash
docker compose -f docker-compose-opencloud.yml up
```

For oCIS:
```bash
docker compose up
docker compose -f docker-compose-ocis.yml up
```

oCIS URL: [localhost:9200](https://localhost:9200)
server URL: [localhost:9200](https://localhost:9200)

## Building Docker Container

For OpenCloud:
```bash
docker build --build-arg server=Opencloud -t jankaritech/mdpresentation-viewer-opencloud:<version> .
```


For Ocis:
```bash
docker build --build-arg server=Ocis -t jankaritech/mdpresentation-viewer-ocis:<version> .
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
condition: service_completed_successfully

mdpresentation-viewer:
image: jankaritech/mdpresentation-viewer:2.0.0
image: jankaritech/mdpresentation-viewer:2.1.0
volumes:
- ocis-apps:/apps
entrypoint:
Expand Down
14 changes: 14 additions & 0 deletions deployments/mdpresentation-viewer-opencloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
services:
opencloud:
depends_on:
mdpresentation-viewer:
condition: service_completed_successfully

mdpresentation-viewer:
image: jankaritech/mdpresentation-viewer-opencloud:2.1.0
volumes:
- opencloud-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /app/* /apps"]
File renamed without changes.
22 changes: 22 additions & 0 deletions docker-compose-opencloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
opencloud:
image: opencloudeu/opencloud-rolling:${OC_IMAGE_TAG:-latest}
entrypoint: /bin/sh
command: ['-c', 'opencloud init || true && opencloud server']
ports:
- 9200:9200
environment:
OC_URL: https://localhost:9200
OC_INSECURE: true
OC_LOG_LEVEL: error
# WEB
WEB_ASSET_APPS_PATH: /web/apps
# IDM
IDM_CREATE_DEMO_USERS: true
IDM_ADMIN_PASSWORD: admin
# PROXY
PROXY_ENABLE_BASIC_AUTH: true
PROXY_CSP_CONFIG_FILE_LOCATION: /etc/opencloud/csp.yml
volumes:
- ./dist:/web/apps:ro
- ./dev/config/csp.yml:/etc/opencloud/csp.yml
36 changes: 15 additions & 21 deletions package.json → package-common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mdpresentation-viewer",
"version": "2.1.0-alpha.1",
"description": "Markdown Presentation Viewer for ownCloud Web",
"description": "Markdown Presentation Viewer for OpenCloud and ownCloud Web",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand All @@ -15,35 +15,29 @@
},
"dependencies": {
"@types/reveal.js": "^4.4.8",
"reveal.js": "^5.2.1"
"reveal.js": "^5.1.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.27.0",
"@cucumber/cucumber": "^10.9.0",
"@babel/eslint-parser": "^7.24.5",
"@cucumber/cucumber": "^10.6.0",
"@cucumber/pretty-formatter": "^1.0.1",
"@ownclouders/extension-sdk": "^11.3.1",
"@ownclouders/prettier-config": "0.0.1",
"@playwright/test": "^1.51.1",
"@types/node": "^20.17.28",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@vitejs/plugin-vue": "^5.2.3",
"@playwright/test": "^1.44.0",
"@types/node": "^20.12.10",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@vitejs/plugin-vue": "^5.0.5",
"@vitest/coverage-v8": "1.6.1",
"@vue/test-utils": "^2.4.6",
"axios": "^1.8.4",
"eslint": "^8.57.1",
"axios": "^1.8.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier-vue": "^5.0.0",
"eslint-plugin-unused-imports": "^3.2.0",
"eslint-plugin-vue": "^9.33.0",
"happy-dom": "^15.11.7",
"typescript": "^5.8.2",
"vite": "^5.4.16",
"eslint-plugin-vue": "^9.25.0",
"happy-dom": "^15.10.2",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vitest": "^1.6.1",
"vue": "^3.5.13"
},
"peerDependencies": {
"@ownclouders/web-client": "^11.3.1",
"@ownclouders/web-pkg": "^11.3.1"
"vue": "^3.5.11"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
10 changes: 10 additions & 0 deletions package-ocis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devDependencies": {
"@ownclouders/extension-sdk": "^11.3.1",
"@ownclouders/prettier-config": "0.0.1"
},
"peerDependencies": {
"@ownclouders/web-client": "^11.3.1",
"@ownclouders/web-pkg": "^11.3.1"
}
}
10 changes: 10 additions & 0 deletions package-opencloud.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"devDependencies": {
"@opencloud-eu/extension-sdk": "^1.0.0",
"@opencloud-eu/prettier-config": "^1.0.0"
},
"peerDependencies": {
"@opencloud-eu/web-client": "^1.0.0",
"@opencloud-eu/web-pkg": "^1.0.0"
}
}
Loading