Plugin import procedure

Astrosias

Hi,

I have developed a plugin for webodm that I would like to use on my production WEBOdm server.

The plugin works perfectly fine on my development machine, when starting the server using ./webodm.sh start --dev. The plugin's structure looks like this:

video_editor/
├── __init__.py
├── manifest.json
├── plugin.py
├── public
│   ├── Pilko-Frame-Capture-Studio
│   │   ├── assets
│   │   │   ├── Arcane - Come Play Series Trailer.mp4
│   │   │   └── Arcane - Come Play Series Trailer.srt
│   │   ├── CNAME
│   │   ├── favicon.ico
│   │   ├── index.html
│   │   ├── LICENSE
│   │   └── README.md
│   └── webpack.config.js
├── __pycache__
│   ├── __init__.cpython-39.pyc
│   └── plugin.cpython-39.pyc
└── templates
    └── app.html

I then zipped the plugin folder, and imported it on my production server. The import is successful and I can activate the plugin, but the files in the public folder on the plugin are placed inapp/media/plugins/video_editor/, where WEBODm is apparently unable to find them. When looking at the server logs or the browser's console, it appears that manifest.json andtemplates/app.html can be loaded, but not public/Pilko-Frame-Capture-Studio/index.html.

This is what is present on the server:

root@docker:/webodm/app/media/plugins# tree
.
|-- __init__.py
|-- __pycache__
|   `-- __init__.cpython-39.pyc
`-- video_editor
    |-- __init__.py
    |-- __pycache__
    |   |-- __init__.cpython-39.pyc
    |   `-- plugin.cpython-39.pyc
    |-- manifest.json
    |-- plugin.py
    |-- public
    |   |-- Pilko-Frame-Capture-Studio
    |   |   |-- CNAME
    |   |   |-- LICENSE
    |   |   |-- README.md
    |   |   |-- assets
    |   |   |   |-- Arcane\ -\ Come\ Play\ Series\ Trailer.mp4
    |   |   |   `-- Arcane\ -\ Come\ Play\ Series\ Trailer.srt
    |   |   |-- favicon.ico
    |   |   `-- index.html
    |   `-- webpack.config.js
    `-- templates
        `-- app.html

Could someone show me how to correctly import my plugin ?

7 Replies

pierotofy

Mm, strange, what if you place a test file in public (e.g. public/test.txt), are you able to retrieve that? I wonder if it's a problem with the Pilko-Frame-Capture-Studio subdirectory, I don't think I've ever tested subdirectories in the public dir

Astrosias OP

I just updated templates/app.html to point to index.html instead of Pilko-Frame-Capture-Studio/index.html, and copied index.html to the public folder.
It works! But I can't access the assets folder obviously.

Astrosias OP

But I would really prefer using folders, as I have another plugin in the works that requires way more files. I can't have all of them sitting in the same folder.

👍 1
pierotofy

It might be a problem with how the plugin system delivers the public assets folder in production. You said this works fine in the dev environment?

If you can open an issue on GitHub with reproduction steps using a minimal example it would help track this 🙏

Astrosias OP

Yes, I had no problem in my dev environment, even using deeper folder structures.
I'll open an issue, it's very easy to reproduce.

Astrosias OP

I just tested it, and I have the same problem in my dev environment. But I develop my plugins putting them in the coreplugins folder, where for some reason everything works.

Astrosias OP

I just made an hello world plugins trying to reproduce this error, and it did work with this folder structure:

├── disabled
├── __init__.py
├── manifest.json
├── plugin.py
├── public
│   └── problematic_folder
│       └── index.html
└── templates
    └── hello.html

It might not be that easy to reproduce after all.

Need more help?

This discussion happened in the WebODM community Discord. Join and ask your own question.

Join View Original Thread

This page mirrors a public discussion from the WebODM Discord. How to request a removal.