Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlink to custom_img in library folder #280

Open
henryk86 opened this issue Dec 30, 2024 · 1 comment
Open

Symlink to custom_img in library folder #280

henryk86 opened this issue Dec 30, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@henryk86
Copy link
Collaborator

henryk86 commented Dec 30, 2024

It would be a simple solution to upload custom images for the tonies.custom.json if the custom_img folder would be available within the library.

it could be done within the docker compose file

after volumes:

command: >
      sh -c "ln -sf /teddycloud/data/www/custom_img/ /teddycloud/data/library/custom_img"

I created a symlink which does this, but in the gui its not recognized as a directory.

http://teddycloud.local/api/fileIndexV2?path=/&special=library

returns isDir = false for a symlink. But if i adapt the code and handle every entry like a directory, it opens the symlink as expected and i can upload a file within.

Can this be fixed easily?

@henryk86 henryk86 added the enhancement New feature or request label Dec 30, 2024
@henryk86
Copy link
Collaborator Author

henryk86 commented Dec 30, 2024

according chatGPT (^^) this should be easily possible (but after some research this works only on specific platform... else it is more complex...):

error_t handleApiFileIndexV2(HttpConnection *connection, const char_t *uri, const char_t *queryString, client_ctx_t *client_ctx)

call a new function:

bool isDirectory(const FileSystemEntry& entry) {
    // Check if it's a directory using attributes
    if (entry.attributes & FS_FILE_ATTR_DIRECTORY) {
        return true;
    }

    // Check if it's a symlink
    if (entry.attributes & FS_FILE_ATTR_SYMLINK) {
        struct stat info;
        // Resolve the symlink and check if the target is a directory
        if (stat(entry.path.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) {
            return true;
        }
    }

    return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant