nextcloud--files_linkeditor
A nextcloud app to edit .URL and .webloc files and visit links stored in them.
Features
- Click on any .URL (Windows) or .webloc (macOS) file in the Nextcloud webinterface to see the link and have the option to visit it directly.
- Create .URL files (no .webloc files as of v1.0.2) from the Nextcloud webinterface.
- Edit the link inside of .URL and .webloc files from the webinterface, if you have write access to the file.
- Change will also be synced to your Desktop, where you can open the shortcut files.
What are .URL or .webloc files?
If you ever saved a favorite/shortcut in a browser on macOS or Windows, you have thereby created a .webloc or .URL file. Windows saves internet-shortcuts in .URL files and macOS in .webloc files. Example: You drag and drop a shortcut from Firefox to your macOS Desktop -> you have a .webloc file. Now if you sync this file with your Nextcloud, you can view, edit or open the link from within the webinterface.
Why can't I open a link file in a new window/tab without confirmation
See this Pull Request for an extensive discussion: #20.
Development
The client-side JavaScript of this plugin uses ES6 features and needs to be transpiled for use in a browser. To run a watch command that automatically updates the bundle.js
file when you make changes, execute npm run dev
. To make a simple build, use npm build
.
Before building or development, dependencies need to be installed once, by running npm install
.
Automated testing
Unit tests
Unit tests are run using Jest. Tests can be found in the jest
directory. To run tests, run npm run test
in the project's directory.
End-to-end tests
Some end-to-end testing is done using Cypress. Tests currently cover basic features of the app and run in a headless Chrome browser on a dockerized Nextcloud instance. For this repository tests run on a mirror repository on Gitlab.
To run tests locally, change into the tests
directory. Before running or working on tests, run npm install
to install dependencies. Make sure to create a .env
file based on .env.example
and a cypress.env.json
based on cypress.env.example.json
; values can be chosen freely, only make sure they align between the two files.
To run the app install docker and docker-compose on your machine. Then run docker-compose up
, followed by docker exec $(docker ps -qf "name=app") sh -c 'chown www-data:root custom_apps'
. Wait for the app to be ready, then run docker exec -u www-data $(docker ps -qf "name=app") sh -c 'php -f ./occ app:disable firstrunwizard'
.
Finally, run npm start
and use Cypress' UI to start running the tests included in the spec file.
To shut down containers and delete the temporary volumes, run docker-compose down -v
in a second terminal while you're in the same tests
directory.
Test cases might depend on running in a specific order. This means you might need to wind down your docker containers and start them again as described above when re-running tests.
New features are supposed to be covered by end-to-end tests in a way that reflects their average usage.
Bugfixes are supposed to include a test case that demonstrates the bug being fixed and prevent it to be re-introduced in the future.
Changelog
The changelog is available in the CHANGELOG file