Son aktivite 19 hours ago

KarelWintersky bu gisti düzenledi 19 hours ago. Düzenlemeye git

1 file changed, 1 insertion, 1 deletion

metube.sh

@@ -95,7 +95,7 @@ step "Building frontend"
95 95 if [[ -d "$APP_DIR/ui" ]]; then
96 96 cd "$APP_DIR/ui"
97 97 /root/.local/share/pnpm/pnpm install --frozen-lockfile
98 - /root/.local/share/pnpm/ run build
98 + /root/.local/share/pnpm/pnpm run build
99 99 else
100 100 error "UI directory not found"
101 101 fi

KarelWintersky bu gisti düzenledi 19 hours ago. Düzenlemeye git

Değişiklik yok

KarelWintersky bu gisti düzenledi 19 hours ago. Düzenlemeye git

1 file changed, 2 insertions, 2 deletions

metube.sh

@@ -94,8 +94,8 @@ rm metube.tar.gz
94 94 step "Building frontend"
95 95 if [[ -d "$APP_DIR/ui" ]]; then
96 96 cd "$APP_DIR/ui"
97 - pnpm install --frozen-lockfile
98 - pnpm run build
97 + /root/.local/share/pnpm/pnpm install --frozen-lockfile
98 + /root/.local/share/pnpm/ run build
99 99 else
100 100 error "UI directory not found"
101 101 fi

KarelWintersky bu gisti düzenledi 19 hours ago. Düzenlemeye git

1 file changed, 7 insertions, 2 deletions

metube.sh

@@ -42,7 +42,12 @@ info "Found Deno archive: $DENO_ARCHIVE_PATH"
42 42 # Install dependencies
43 43 step "Installing system dependencies"
44 44 apt-get update
45 - apt-get install -y curl wget unzip git build-essential python3 python3-pip python3-venv nodejs npm
45 + apt-get install -y curl wget unzip git build-essential python3 python3-pip python3-venv
46 +
47 + step "Installing NODEJS"
48 + curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
49 + apt install -y nodejs
50 + npm install -g pm2
46 51
47 52 # Install Deno from local archive
48 53 step "Installing Deno from local archive"
@@ -63,7 +68,7 @@ fi
63 68
64 69 # Install pnpm
65 70 step "Installing pnpm"
66 - npm install -g pnpm
71 + curl -fsSL https://get.pnpm.io/install.sh | sh -
67 72
68 73 # Download and setup MeTube
69 74 step "Downloading MeTube from GitHub"

KarelWintersky bu gisti düzenledi 19 hours ago. Düzenlemeye git

1 file changed, 180 insertions

metube.sh(dosya oluşturuldu)

@@ -0,0 +1,180 @@
1 + #!/usr/bin/env bash
2 +
3 + # MeTube installation script with offline Deno installation
4 + # Place this script and deno-x86_64-unknown-linux-gnu.zip in the same directory
5 +
6 + set -e
7 +
8 + APP="MeTube"
9 + APP_DIR="/opt/metube"
10 + DENO_INSTALL_DIR="/usr/local"
11 + DENO_ZIP="deno-x86_64-unknown-linux-gnu.zip"
12 + GITHUB_REPO="alexta69/metube"
13 + SERVICE_USER="root"
14 +
15 + # Colors for output
16 + RED='\033[0;31m'
17 + GREEN='\033[0;32m'
18 + YELLOW='\033[1;33m'
19 + BLUE='\033[0;34m'
20 + NC='\033[0m'
21 +
22 + info() { echo -e "${GREEN}[INFO]${NC} $1"; }
23 + warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
24 + error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
25 + step() { echo -e "${BLUE}[STEP]${NC} $1"; }
26 +
27 + # Check if running as root
28 + if [[ $EUID -ne 0 ]]; then
29 + error "This script must be run as root"
30 + fi
31 +
32 + # Check for local Deno archive
33 + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
34 + DENO_ARCHIVE_PATH="${SCRIPT_DIR}/${DENO_ZIP}"
35 +
36 + if [[ ! -f "$DENO_ARCHIVE_PATH" ]]; then
37 + error "Deno archive not found at $DENO_ARCHIVE_PATH"
38 + fi
39 +
40 + info "Found Deno archive: $DENO_ARCHIVE_PATH"
41 +
42 + # Install dependencies
43 + step "Installing system dependencies"
44 + apt-get update
45 + apt-get install -y curl wget unzip git build-essential python3 python3-pip python3-venv nodejs npm
46 +
47 + # Install Deno from local archive
48 + step "Installing Deno from local archive"
49 + if [[ -d "${DENO_INSTALL_DIR}/deno" ]]; then
50 + rm -rf "${DENO_INSTALL_DIR}/deno"
51 + fi
52 +
53 + unzip -o "$DENO_ARCHIVE_PATH" -d /tmp/deno_extract
54 + chmod +x /tmp/deno_extract/deno
55 + mv /tmp/deno_extract/deno "${DENO_INSTALL_DIR}/bin/deno"
56 + rm -rf /tmp/deno_extract
57 +
58 + if command -v deno >/dev/null 2>&1; then
59 + info "Deno installed successfully: $(deno --version)"
60 + else
61 + error "Deno installation failed"
62 + fi
63 +
64 + # Install pnpm
65 + step "Installing pnpm"
66 + npm install -g pnpm
67 +
68 + # Download and setup MeTube
69 + step "Downloading MeTube from GitHub"
70 + LATEST_URL=$(curl -s "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" | grep "tarball_url" | cut -d '"' -f 4)
71 +
72 + if [[ -z "$LATEST_URL" ]]; then
73 + error "Failed to get latest release URL"
74 + fi
75 +
76 + if [[ -d "$APP_DIR" ]]; then
77 + warn "Existing installation found, backing up..."
78 + mv "$APP_DIR" "${APP_DIR}_bak_$(date +%Y%m%d_%H%M%S)"
79 + fi
80 +
81 + mkdir -p "$APP_DIR"
82 + cd "$APP_DIR"
83 +
84 + curl -L "$LATEST_URL" -o metube.tar.gz
85 + tar -xzf metube.tar.gz --strip-components=1
86 + rm metube.tar.gz
87 +
88 + # Build frontend
89 + step "Building frontend"
90 + if [[ -d "$APP_DIR/ui" ]]; then
91 + cd "$APP_DIR/ui"
92 + pnpm install --frozen-lockfile
93 + pnpm run build
94 + else
95 + error "UI directory not found"
96 + fi
97 +
98 + # Setup Python backend
99 + step "Setting up Python backend"
100 + cd "$APP_DIR"
101 + python3 -m venv .venv
102 + source .venv/bin/activate
103 + pip install --upgrade pip
104 + pip install yt-dlp aiohttp python-dotenv
105 +
106 + # Check for requirements.txt
107 + if [[ -f "$APP_DIR/requirements.txt" ]]; then
108 + pip install -r requirements.txt
109 + fi
110 +
111 + # Create .env file
112 + step "Creating configuration"
113 + if [[ ! -f "$APP_DIR/.env" ]]; then
114 + cat > "$APP_DIR/.env" <<EOF
115 + # MeTube Configuration
116 + DOWNLOAD_DIR=/downloads
117 + STATE_DIR=/opt/metube/state
118 + URL_PREFIX=
119 + HTTP_USERNAME=
120 + HTTP_PASSWORD=
121 + YTDL_OPTIONS=
122 + EOF
123 + fi
124 +
125 + # Create download and state directories
126 + mkdir -p /downloads
127 + mkdir -p "$APP_DIR/state"
128 +
129 + # Create systemd service
130 + step "Creating systemd service"
131 + cat > /etc/systemd/system/metube.service <<EOF
132 + [Unit]
133 + Description=MeTube - YouTube Downloader
134 + After=network.target
135 +
136 + [Service]
137 + Type=simple
138 + WorkingDirectory=${APP_DIR}
139 + EnvironmentFile=${APP_DIR}/.env
140 + ExecStart=${APP_DIR}/.venv/bin/python3 ${APP_DIR}/app/main.py
141 + Restart=always
142 + User=root
143 + StandardOutput=journal
144 + StandardError=journal
145 +
146 + [Install]
147 + WantedBy=multi-user.target
148 + EOF
149 +
150 + # Reload systemd and start service
151 + step "Starting MeTube service"
152 + systemctl daemon-reload
153 + systemctl enable metube
154 + systemctl start metube
155 +
156 + # Check if service is running
157 + sleep 3
158 + if systemctl is-active --quiet metube; then
159 + info "MeTube service started successfully"
160 + else
161 + error "MeTube service failed to start. Check logs with: journalctl -u metube"
162 + fi
163 +
164 + # Get IP address
165 + IP_ADDRESS=$(hostname -I | awk '{print $1}')
166 +
167 + echo ""
168 + echo -e "${GREEN}========================================${NC}"
169 + echo -e "${GREEN}MeTube installation completed!${NC}"
170 + echo -e "${GREEN}========================================${NC}"
171 + echo -e "Access MeTube at: ${YELLOW}http://${IP_ADDRESS}:8081${NC}"
172 + echo ""
173 + echo -e "Commands:"
174 + echo -e " Start: ${BLUE}systemctl start metube${NC}"
175 + echo -e " Stop: ${BLUE}systemctl stop metube${NC}"
176 + echo -e " Status: ${BLUE}systemctl status metube${NC}"
177 + echo -e " Logs: ${BLUE}journalctl -u metube -f${NC}"
178 + echo ""
179 + echo -e "Download directory: ${YELLOW}/downloads${NC}"
180 + echo -e "Config file: ${YELLOW}${APP_DIR}/.env${NC}"
Daha yeni Daha eski