diff --git a/conf/config-sample.js b/conf/config-sample.js deleted file mode 100644 index 6209d21..0000000 --- a/conf/config-sample.js +++ /dev/null @@ -1,146 +0,0 @@ -// DO NOT EDIT THIS FILE! -// THIS FILE IS JUST A SAMPLE; TO APPLY, YOU MUST -// CREATE A NEW FILE config.js AND ADD CONTENTS -// SUCH AS SHOWN BELOW INTO THAT FILE. - -/*globals svgEditor*/ -/* -The config.js file is intended for the setting of configuration or - preferences which must run early on; if this is not needed, it is - recommended that you create an extension instead (for greater - reusability and modularity). -*/ - -// CONFIG AND EXTENSION SETTING -/* -See defaultConfig and defaultExtensions in svg-editor.js for a list - of possible configuration settings. - -See svg-editor.js for documentation on using setConfig(). -*/ - -// URL OVERRIDE CONFIG -svgEditor.setConfig({ - /** - To override the ability for URLs to set URL-based SVG content, - uncomment the following: - */ - // preventURLContentLoading: true, - /** - To override the ability for URLs to set other configuration (including - extension config), uncomment the following: - */ - // preventAllURLConfig: true, - /** - To override the ability for URLs to set their own extensions, - uncomment the following (note that if setConfig() is used in - extension code, it will still be additive to extensions, - however): - */ - // lockExtensions: true, -}); - -svgEditor.setConfig({ - /* - Provide default values here which differ from that of the editor but - which the URL can override - */ -}, {allowInitialUserOverride: true}); - -// EXTENSION CONFIG -svgEditor.setConfig({ - extensions: [ - // 'ext-overview_window.js', 'ext-markers.js', 'ext-connector.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-imagelib.js', 'ext-grid.js', 'ext-polygon.js', 'ext-star.js', 'ext-panning.js', 'ext-storage.js' - ] - // , noDefaultExtensions: false, // noDefaultExtensions can only be meaningfully used in config.js or in the URL -}); - -// OTHER CONFIG -svgEditor.setConfig({ - // canvasName: 'default', - // canvas_expansion: 3, - // initFill: { - // color: 'FF0000', // solid red - // opacity: 1 - // }, - // initStroke: { - // width: 5, - // color: '000000', // solid black - // opacity: 1 - // }, - // initOpacity: 1, - // colorPickerCSS: null, - // initTool: 'select', - // exportWindowType: 'new', // 'same' - // wireframe: false, - // showlayers: false, - // no_save_warning: false, - // PATH CONFIGURATION - // imgPath: 'images/', - // langPath: 'locale/', - // extPath: 'extensions/', - // jGraduatePath: 'jgraduate/images/', - /* - Uncomment the following to allow at least same domain (embedded) access, - including file:// access. - Setting as `['*']` would allow any domain to access but would be unsafe to - data privacy and integrity. - */ - // allowedOrigins: [window.location.origin || 'null'], // May be 'null' (as a string) when used as a file:// URL - // DOCUMENT PROPERTIES - // dimensions: [640, 480], - // EDITOR OPTIONS - // gridSnapping: false, - // gridColor: '#000', - // baseUnit: 'px', - // snappingStep: 10, - // showRulers: true, - // EXTENSION-RELATED (GRID) - // showGrid: false, // Set by ext-grid.js - // EXTENSION-RELATED (STORAGE) - // noStorageOnLoad: false, // Some interaction with ext-storage.js; prevent even the loading of previously saved local storage - // forceStorage: false, // Some interaction with ext-storage.js; strongly discouraged from modification as it bypasses user privacy by preventing them from choosing whether to keep local storage or not - // emptyStorageOnDecline: true, // Used by ext-storage.js; empty any prior storage if the user declines to store -}); - -// PREF CHANGES -/** -setConfig() can also be used to set preferences in addition to - configuration (see defaultPrefs in svg-editor.js for a list of - possible settings), but at least if you are using ext-storage.js - to store preferences, it will probably be better to let your - users control these. -As with configuration, one may use allowInitialUserOverride, but - in the case of preferences, any previously stored preferences - will also thereby be enabled to override this setting (and at a - higher priority than any URL preference setting overrides). - Failing to use allowInitialUserOverride will ensure preferences - are hard-coded here regardless of URL or prior user storage setting. -*/ -svgEditor.setConfig( - { - // lang: '', // Set dynamically within locale.js if not previously set - // iconsize: '', // Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise - /** - * When showing the preferences dialog, svg-editor.js currently relies - * on curPrefs instead of $.pref, so allowing an override for bkgd_color - * means that this value won't have priority over block auto-detection as - * far as determining which color shows initially in the preferences - * dialog (though it can be changed and saved). - */ - // bkgd_color: '#FFF', - // bkgd_url: '', - // img_save: 'embed', - // Only shows in UI as far as alert notices - // save_notice_done: false, - // export_notice_done: false - } -); -svgEditor.setConfig( - { - // Indicate pref settings here if you wish to allow user storage or URL settings - // to be able to override your default preferences (unless other config options - // have already explicitly prevented one or the other) - }, - {allowInitialUserOverride: true} -); diff --git a/conf/nginx.conf b/conf/nginx.conf index 8d0b5fa..440fc65 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __INSTALL_DIR__/; + alias __INSTALL_DIR__/www; index svg-editor.html ; diff --git a/doc/PRE_UPGRADE_7.0.md b/doc/PRE_UPGRADE_7.0.md new file mode 100644 index 0000000..3831e6f --- /dev/null +++ b/doc/PRE_UPGRADE_7.0.md @@ -0,0 +1 @@ +This upgrade dropped support of config.js. Please back it up if you customized it. diff --git a/manifest.toml b/manifest.toml index bce77bf..2c3697f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -45,8 +45,9 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/SVG-Edit/svgedit/releases/download/svg-edit-2.8.1/svg-edit-2.8.1.zip" - sha256 = "416799c4fcb3dcbe7fa5c4ac6409a2891afc4fa759b654bcb5e6df55e259bfe1" + url = "https://github.com/SVG-Edit/svgedit/archive/refs/tags/v.7.3.3.tar.gz" + sha256 = "c543111cbdc6b72781e957941fa0382f1026d0ada81a31177a5688a9104766d7" + autoupdate.strategy = "latest_github_release" [resources.system_user] diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..44277c5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,8 @@ # COMMON VARIABLES #================================================= +nodejs_version=20 + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index ac67331..be7a740 100755 --- a/scripts/install +++ b/scripts/install @@ -9,28 +9,40 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=6 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/source" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= -# SPECIFIC SETUP +# BUILD WITH NPM #================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Building $app..." --weight=1 -ynh_add_config --template="config-sample.js" --destination="$install_dir/config.js" +pushd "$install_dir/source" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" npm i + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" npm run build + ynh_secure_remove --file="node_modules" +popd -chmod 400 "$install_dir/config.js" -chown "$app:$app" "$install_dir/config.js" +mv "$install_dir/source/dist/editor" "$install_dir/www" + +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # SYSTEM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 4eabb02..4550dea 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,23 +27,28 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" + ynh_setup_source --dest_dir="$install_dir/source" fi chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= -# SPECIFIC UPGRADE +# BUILD WITH NPM #================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." +ynh_script_progression --message="Building $app..." --weight=1 -ynh_add_config --template="config-sample.js" --destination="$install_dir/config.js" +pushd "$install_dir/source" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" npm i + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" npm run build + ynh_secure_remove --file="node_modules" +popd -chmod 400 "$install_dir/config.js" -chown "$app:$app" "$install_dir/config.js" +mv "$install_dir/source/dist/editor" "$install_dir/www" + +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # END OF SCRIPT