Fix remote Transmission detection and config directory creation

- Fix bug where installer doesn't ask if Transmission is remote
- Fix missing configuration directory in /etc/transmission-rss-manager
- Create symlink between config locations to ensure app always finds config
- Ensure CONFIG_DIR is properly exported in the environment
- Update version to 2.0.4

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MasterDraco 2025-03-05 08:39:21 +00:00
parent c495bce21f
commit 4c68a1ac07
7 changed files with 60 additions and 71 deletions

View File

@ -1,9 +1,14 @@
# Transmission RSS Manager v2.0.3 # Transmission RSS Manager v2.0.4
A comprehensive web-based tool to automate and manage your Transmission torrent downloads with RSS feed integration, intelligent media organization, and enhanced security features. Now with automatic updates and easy installation! A comprehensive web-based tool to automate and manage your Transmission torrent downloads with RSS feed integration, intelligent media organization, and enhanced security features. Now with automatic updates and easy installation!
## Changelog ## Changelog
### v2.0.4 (2025-03-05)
- **Fixed**: Remote transmission detection in installer
- **Fixed**: Configuration directory creation and permissions
- **Fixed**: Config file symlink now ensures application finds correct config location
### v2.0.3 (2025-03-05) ### v2.0.3 (2025-03-05)
- **New**: Configuration file now stored in `/etc/transmission-rss-manager/` - **New**: Configuration file now stored in `/etc/transmission-rss-manager/`
- **Improved**: Installer creates config directory with proper permissions - **Improved**: Installer creates config directory with proper permissions

View File

@ -146,6 +146,8 @@ else
# Step 3: Create installation directories # Step 3: Create installation directories
log "INFO" "Creating directories..." log "INFO" "Creating directories..."
# Make sure CONFIG_DIR is set and exported
export CONFIG_DIR=${CONFIG_DIR:-"/etc/transmission-rss-manager"}
create_directories || { create_directories || {
log "ERROR" "Directory creation failed" log "ERROR" "Directory creation failed"
exit 1 exit 1

View File

@ -114,6 +114,7 @@ function gather_configuration() {
read -p "Is Transmission running on a remote server? (y/n) [n]: " input_remote read -p "Is Transmission running on a remote server? (y/n) [n]: " input_remote
if [[ $input_remote =~ ^[Yy]$ ]]; then if [[ $input_remote =~ ^[Yy]$ ]]; then
TRANSMISSION_REMOTE=true TRANSMISSION_REMOTE=true
export TRANSMISSION_REMOTE=true
# Get and validate hostname # Get and validate hostname
while true; do while true; do
@ -227,6 +228,9 @@ function gather_configuration() {
TRANSMISSION_DOWNLOAD_DIR=$REMOTE_DOWNLOAD_DIR TRANSMISSION_DOWNLOAD_DIR=$REMOTE_DOWNLOAD_DIR
else else
# Local Transmission selected # Local Transmission selected
TRANSMISSION_REMOTE=false
export TRANSMISSION_REMOTE=false
echo -e "${YELLOW}You've selected to use a local Transmission installation.${NC}" echo -e "${YELLOW}You've selected to use a local Transmission installation.${NC}"
# Check if Transmission is already installed # Check if Transmission is already installed

View File

@ -35,8 +35,8 @@ function install_dependencies() {
log "INFO" "Node.js is already installed." log "INFO" "Node.js is already installed."
fi fi
# Check if we need to install Transmission (only if local transmission was selected and not remote) # Check if we need to install Transmission (only if local transmission was selected)
if [ "$TRANSMISSION_REMOTE" = false ] && ([ "$TRANSMISSION_HOST" = "localhost" ] || [ "$TRANSMISSION_HOST" = "127.0.0.1" ]); then if [ "$TRANSMISSION_REMOTE" = false ]; then
if ! command_exists transmission-daemon; then if ! command_exists transmission-daemon; then
log "INFO" "Local Transmission installation selected, but transmission-daemon is not installed." log "INFO" "Local Transmission installation selected, but transmission-daemon is not installed."
read -p "Would you like to install Transmission now? (y/n): " install_transmission read -p "Would you like to install Transmission now? (y/n): " install_transmission
@ -109,8 +109,8 @@ function install_dependencies() {
local dependencies=("node" "npm" "unzip" "nginx") local dependencies=("node" "npm" "unzip" "nginx")
local missing_deps=() local missing_deps=()
# Add transmission to dependencies check if local installation was selected and not remote # Add transmission to dependencies check if local installation was selected
if [ "$TRANSMISSION_REMOTE" = false ] && ([ "$TRANSMISSION_HOST" = "localhost" ] || [ "$TRANSMISSION_HOST" = "127.0.0.1" ]); then if [ "$TRANSMISSION_REMOTE" = false ]; then
dependencies+=("transmission-daemon") dependencies+=("transmission-daemon")
fi fi
@ -191,5 +191,9 @@ function create_directories() {
chown -R "$USER:$USER" "$CONFIG_DIR" chown -R "$USER:$USER" "$CONFIG_DIR"
chmod 755 "$CONFIG_DIR" chmod 755 "$CONFIG_DIR"
# Create a symlink from the installation directory to the config directory
# This ensures the application can find the config regardless of where it looks
ln -sf "$CONFIG_DIR/config.json" "$INSTALL_DIR/config.json"
log "INFO" "Directories created successfully." log "INFO" "Directories created successfully."
} }

View File

@ -6,6 +6,7 @@ function create_config_files() {
# Create initial config.json # Create initial config.json
echo "Creating config.json..." echo "Creating config.json..."
mkdir -p "$CONFIG_DIR"
cat > $CONFIG_DIR/config.json << EOF cat > $CONFIG_DIR/config.json << EOF
{ {
"version": "2.0.3", "version": "2.0.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "transmission-rss-manager", "name": "transmission-rss-manager",
"version": "2.0.3", "version": "2.0.4",
"description": "A comprehensive web-based tool to automate and manage your Transmission torrent downloads with RSS feed integration and intelligent media organization", "description": "A comprehensive web-based tool to automate and manage your Transmission torrent downloads with RSS feed integration and intelligent media organization",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {

View File

@ -1,75 +1,48 @@
# Git-Based Installation and Update System # Changes for Moving Config File to /etc/transmission-rss-manager
We've restructured the Transmission RSS Manager to use a git-based approach for installation and updates. Here's how the new system works: ## Overview
This update moves the configuration file from the application directory to `/etc/transmission-rss-manager/config.json` for better system organization, while maintaining backward compatibility by checking the original location as a fallback.
## New Architecture ## Changes Made
1. **Bootstrap Installer** ### 1. Server.js Updates
- Small, self-contained installer script - Changed default config location to `/etc/transmission-rss-manager/config.json`
- Installs git if needed - Added fallback location (`path.join(__dirname, 'config.json')`) for backward compatibility
- Clones the main repository - Enhanced `loadConfig()` function to try primary location first, then fallback location
- Runs the main installer - Updated `saveConfig()` function to try saving to primary location first, then fallback
- Added `installPath` property to configuration to store the application installation path for easier updates
2. **Main Installer** ### 2. Installer Updates
- Modified to work with git-managed files - Added `CONFIG_DIR="/etc/transmission-rss-manager"` variable to config-module.sh
- Doesn't need to generate application files - Updated `create_directories()` in dependencies-module.sh to create the config directory
- Only creates config files and sets up services - Updated permission settings to ensure proper access to config directory
- Added checks for the CONFIG_DIR variable to ensure it's set
- Modified service-setup-module.sh to include CONFIG_DIR in the environment variables for the systemd service
- Updated file-creator-module.sh to write the initial config.json to the new location
3. **Update System** ### 3. Documentation Updates
- Web interface shows current version - Updated README.md to reflect new config file location
- Checks for updates automatically - Added entry to the changelog for version 2.0.3
- One-click update process - Updated code examples in README
- Preserves user configuration - Bumped version from 2.0.2 to 2.0.3 in both README.md and package.json
## Key Files ## Technical Details
1. **bootstrap-installer.sh** ### Config File Loading Process
- Entry point for new installations 1. Try to load config from primary location (`/etc/transmission-rss-manager/config.json`)
- Minimal script that pulls everything else from git 2. If not found, try fallback location (`<install_dir>/config.json`)
3. If neither exists, create a new config file at primary location
4. If primary location is not writable, fall back to application directory
2. **update.sh** ### Configuration Storage Logic
- Located in the scripts/ directory - Primary storage location: `/etc/transmission-rss-manager/config.json`
- Handles git pull and service restart - Fallback location: `<install_dir>/config.json`
- Preserves local configuration changes - Automatic migration from fallback to primary when possible
- Always try to write to primary first, then fallback if needed
3. **System Status UI**
- Added to the dashboard
- Shows version, uptime, and connection status
- Notifies when updates are available
4. **Server Endpoints**
- `/api/system/status` - Gets current version and system status
- `/api/system/check-updates` - Checks if updates are available
- `/api/system/update` - Triggers the update process
## Benefits ## Benefits
- More standard Linux configuration location in /etc
1. **Simplified Maintenance** - Easier to find and edit configuration
- Single source of truth in the git repository - Clear separation between code and configuration
- No need to embed code in installation scripts - Maintains backward compatibility with existing installations
- Easy to make changes and publish updates - Simplified update process by storing installation path
2. **Better User Experience**
- Users can see when updates are available
- One-click update process
- No need to manually download and run scripts
3. **Version Control**
- Clear versioning visible to users
- Update history preserved in git
- Easy rollback if needed
## Implementation Notes
This implementation preserves local configuration by:
1. Stashing local changes before pulling updates
2. Applying those changes back after the update
3. Handling any potential conflicts
The service automatically restarts after updates, ensuring users always have the latest version running.
## Next Steps
1. Update the GitHub repository structure to match this new approach
2. Test the installation and update process in a clean environment
3. Consider adding a changelog display in the UI to show what's new in each version