bassmanitram / actions-for-nautilus

An extension to the Gnome "Files" file manager that allows you to add arbitrary actions to the file selection context menu.
Apache License 2.0
165 stars 16 forks source link

JQuery gets 404 in configurator #49

Closed maygeisler closed 7 months ago

maygeisler commented 9 months ago

Hi first of all thank you for your amazing app i love it, it really helps with my workflow and me just being more productive over all.

I just noticed that on my personal PC at home i cant save or even click help so i investigated and found out that jquery wasn't loading, after i took a look in the actions-for-nautilus-configurator.py script i saw that the path for the minified jquery file was "path": "/usr/share/javascript/jquery/jquery.min.js", so i just quickly changed the path to be "path": "./javascript/jquery.min.js", bc i saw that you're shipping it with all the other files necessary.

i don't know if that's intended behavior or just an oversight that for example the make install should install jquery into this path but since you're shipping it with all the other files in ./javascript/ i think this can be a fix for now.

here my now working code again:

#!/usr/bin/python3
import http.server
import json
import sys
import os
import shutil
import datetime

PORT = 8000
HOME = os.environ.get('HOME')

# config_html = "./actions-for-nautilus-configurator.html"
# cmdline_help = "./command-line-help.html"
config_file = HOME + \
    "/.local/share/actions-for-nautilus/config.json"
# config_schema = "./actions-for-nautilus.schema.json"
# favicon = "./sub-menu.png"

textual_mimes = [
    "text/html",
    "application/json",
    "text/css",
    "application/javascript"
]
docs = {
    "/": {
        "path": "./actions-for-nautilus-configurator-container.html",
        "mimetype": "text/html",
        "default": None
    },
    "/actions-for-nautilus-configurator-container.html": {
        "path": "./actions-for-nautilus-configurator-container.html",
        "mimetype": "text/html",
        "default": None
    },
    "/actions-for-nautilus-configurator.html": {
        "path": "./actions-for-nautilus-configurator.html",
        "mimetype": "text/html",
        "default": None
    },
    "/config": {
        "path": config_file,
        "mimetype": "application/json",
        "default": "{\"actions\":[],\"debug\":false}"
    },
    "/schema": {
        "path": "./actions-for-nautilus.ui.schema.json",
        "mimetype": "application/json",
        "default": None
    },
    "/actions-for-nautilus-configurator-help.html": {
        "path": "./actions-for-nautilus-configurator-help.html",
        "mimetype": "text/html",
        "default": None
    },
    "/favicon.ico": {
        "path": "./images/sub-menu.png",
        "mimetype": "image/png",
        "default": None
    },
    "/webfonts/fa-solid-900.woff2": {
        "path": "./packages/fa-solid-900.woff2",
        "mimetype": "font/woff2",
        "default": None
    },
    "/images/ANY": {
        "path": "./images/",
        "mimetype": "image/png",
        "default": None
    },
    "/javascript/jquery.min.js": {
        "path": "./javascript/jquery.min.js",
        "mimetype": "application/javascript",
        "default": None
    },
    "/javascript/ANY": {
        "path": "./javascript/",
        "mimetype": "application/javascript",
        "default": None
    },
    "/css/ANY": {
        "path": "./css/",
        "mimetype": "text/css",
        "default": None
    },
}
[...]
maygeisler commented 9 months ago

or you just leave out the line where you serve jquery entirely bc you're serving everything in the ./javascript/ folder anyway in the line below. Just strange that it doesn't work for me at all when the path is there and wrong.

bassmanitram commented 9 months ago

Hey... Sorry I haven't got back on this yet. I'll take a look this week, I hope

On Fri, 17 Nov 2023, 23:42 Maileen Geisler, @.***> wrote:

or you just leave out the line where you serve jquery entirely bc you're serving everything in the ./javascript/ folder anyway in the line below. Just strange that it doesn't work for me at all when the path is there and wrong.

— Reply to this email directly, view it on GitHub https://github.com/bassmanitram/actions-for-nautilus/issues/49#issuecomment-1807137898, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAKLWUCTKSIWPB7EOHNQJTYE7R4HAVCNFSM6AAAAAA7IA3IOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXGEZTOOBZHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bassmanitram commented 7 months ago

OK, @maygeisler, I've taken a look :) (finally)

JQuery is a prerequisite when installing the extension. This gets enforced when installing by the DEB file, in which case it gets put into /usr/share/javascript/jquery/jquery.min.js.

The reason I do that rather than just redistribute myself is because when constructing the DEB file I get a nasty warning that I shouldn't do that when the package has its own DEB file.

This means that if you install the DEB file, you should get the jquery stuff properly installed too. But if you install via the install script ... theeeennnn it's a bit messier. It is listed as a prereq in the readme, but on non-DEB systems, if it has its own package it still may get placed somewhere else.

However, I think I can mess with the installation process to have jquery there, NOT include it in the DEB and sort out the non-DEB installation to work properly.

I'll get onto that.

Thanks for using the extension.

bassmanitram commented 7 months ago

@maygeisler - I fixed it in the "Main" branch. Since it only affects "make" installs, I won't make a new release solely for this issue but will include it in the next release that includes other issue resolutions and features.