@anjishnusengupta/ny-cli 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +419 -0
- package/backend.mjs +189 -0
- package/install.sh +161 -0
- package/ny-cli +1219 -0
- package/package.json +42 -0
package/install.sh
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# NY-CLI v3.0 Installation Script
|
|
3
|
+
# Usage: curl -sL https://raw.githubusercontent.com/AnjishnuSengupta/ny-cli/main/install.sh | sh
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Colors
|
|
8
|
+
RED='\033[1;31m'
|
|
9
|
+
GREEN='\033[1;32m'
|
|
10
|
+
YELLOW='\033[1;33m'
|
|
11
|
+
CYAN='\033[1;36m'
|
|
12
|
+
MAGENTA='\033[1;35m'
|
|
13
|
+
WHITE='\033[1;37m'
|
|
14
|
+
DIM='\033[2m'
|
|
15
|
+
RESET='\033[0m'
|
|
16
|
+
|
|
17
|
+
printf "\n"
|
|
18
|
+
printf "${MAGENTA}"
|
|
19
|
+
printf " ███╗ ██╗██╗ ██╗ ██████╗██╗ ██╗\n"
|
|
20
|
+
printf " ████╗ ██║╚██╗ ██╔╝ ██╔════╝██║ ██║\n"
|
|
21
|
+
printf " ██╔██╗ ██║ ╚████╔╝ █████╗██║ ██║ ██║\n"
|
|
22
|
+
printf " ██║╚██╗██║ ╚██╔╝ ╚════╝██║ ██║ ██║\n"
|
|
23
|
+
printf " ██║ ╚████║ ██║ ╚██████╗███████╗██║\n"
|
|
24
|
+
printf " ╚═╝ ╚═══╝ ╚═╝ ╚═════╝╚══════╝╚═╝\n"
|
|
25
|
+
printf "${RESET}\n"
|
|
26
|
+
printf "${DIM}${CYAN} ⟨ Your Gateway to Anime Streaming ⟩${RESET}\n"
|
|
27
|
+
printf "${DIM} ─────────────────────────────────────${RESET}\n"
|
|
28
|
+
printf "${DIM} v3.0.0 • nyanime.tech${RESET}\n"
|
|
29
|
+
printf "\n"
|
|
30
|
+
|
|
31
|
+
REPO_URL="https://raw.githubusercontent.com/AnjishnuSengupta/ny-cli/main"
|
|
32
|
+
|
|
33
|
+
# ─── Check required dependencies ───
|
|
34
|
+
|
|
35
|
+
printf "${CYAN}Checking prerequisites...${RESET}\n"
|
|
36
|
+
|
|
37
|
+
missing=""
|
|
38
|
+
|
|
39
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
40
|
+
missing="$missing nodejs"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
if ! command -v npm >/dev/null 2>&1; then
|
|
44
|
+
missing="$missing npm"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
if ! command -v curl >/dev/null 2>&1 && ! command -v wget >/dev/null 2>&1; then
|
|
48
|
+
missing="$missing curl"
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
if [ -n "$missing" ]; then
|
|
52
|
+
printf "${RED}✗ Missing required dependencies:${RESET}$missing\n"
|
|
53
|
+
printf "\n"
|
|
54
|
+
printf " Install them first:\n"
|
|
55
|
+
printf " ${DIM}Ubuntu/Debian:${RESET} sudo apt install$missing\n"
|
|
56
|
+
printf " ${DIM}Fedora:${RESET} sudo dnf install$missing\n"
|
|
57
|
+
printf " ${DIM}Arch:${RESET} sudo pacman -S$missing\n"
|
|
58
|
+
printf " ${DIM}macOS:${RESET} brew install$missing\n"
|
|
59
|
+
printf "\n"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
node_ver=$(node -v 2>/dev/null | sed 's/v//' | cut -d. -f1)
|
|
64
|
+
if [ -n "$node_ver" ] && [ "$node_ver" -lt 18 ] 2>/dev/null; then
|
|
65
|
+
printf "${RED}✗ Node.js 18+ required (found v$(node -v))${RESET}\n"
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
printf "${GREEN}✓ Node.js $(node -v) found${RESET}\n"
|
|
70
|
+
|
|
71
|
+
# ─── Determine install locations ───
|
|
72
|
+
|
|
73
|
+
if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then
|
|
74
|
+
INSTALL_DIR="${PREFIX:-/usr/local}/lib/ny-cli"
|
|
75
|
+
BIN_DIR="${PREFIX:-/usr/local}/bin"
|
|
76
|
+
else
|
|
77
|
+
INSTALL_DIR="${PREFIX:-$HOME/.local}/lib/ny-cli"
|
|
78
|
+
BIN_DIR="${PREFIX:-$HOME/.local}/bin"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
mkdir -p "$INSTALL_DIR" "$BIN_DIR"
|
|
82
|
+
|
|
83
|
+
# ─── Download files ───
|
|
84
|
+
|
|
85
|
+
download() {
|
|
86
|
+
local url="$1" dest="$2"
|
|
87
|
+
if command -v curl >/dev/null 2>&1; then
|
|
88
|
+
curl -sL "$url" -o "$dest"
|
|
89
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
90
|
+
wget -qO "$dest" "$url"
|
|
91
|
+
fi
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
printf "${CYAN}⟳ Downloading ny-cli v3.0...${RESET}\n"
|
|
95
|
+
|
|
96
|
+
download "$REPO_URL/ny-cli" "$INSTALL_DIR/ny-cli"
|
|
97
|
+
download "$REPO_URL/backend.mjs" "$INSTALL_DIR/backend.mjs"
|
|
98
|
+
download "$REPO_URL/package.json" "$INSTALL_DIR/package.json"
|
|
99
|
+
|
|
100
|
+
chmod +x "$INSTALL_DIR/ny-cli"
|
|
101
|
+
|
|
102
|
+
printf "${GREEN}✓ Files downloaded${RESET}\n"
|
|
103
|
+
|
|
104
|
+
# ─── Install npm dependencies ───
|
|
105
|
+
|
|
106
|
+
printf "${CYAN}⟳ Installing aniwatch package...${RESET}\n"
|
|
107
|
+
|
|
108
|
+
(cd "$INSTALL_DIR" && npm install --production --silent 2>/dev/null) || {
|
|
109
|
+
printf "${RED}✗ npm install failed. Try running manually:${RESET}\n"
|
|
110
|
+
printf " cd $INSTALL_DIR && npm install --production\n"
|
|
111
|
+
exit 1
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
printf "${GREEN}✓ Dependencies installed${RESET}\n"
|
|
115
|
+
|
|
116
|
+
# ─── Create symlink in bin ───
|
|
117
|
+
|
|
118
|
+
ln -sf "$INSTALL_DIR/ny-cli" "$BIN_DIR/ny-cli"
|
|
119
|
+
|
|
120
|
+
printf "${GREEN}✓ Symlinked to $BIN_DIR/ny-cli${RESET}\n"
|
|
121
|
+
|
|
122
|
+
# ─── Check PATH ───
|
|
123
|
+
|
|
124
|
+
case ":$PATH:" in
|
|
125
|
+
*":$BIN_DIR:"*) ;;
|
|
126
|
+
*)
|
|
127
|
+
printf "\n"
|
|
128
|
+
printf "${YELLOW}⚠ $BIN_DIR is not in your PATH${RESET}\n"
|
|
129
|
+
printf " Add this line to your ${DIM}~/.bashrc${RESET} or ${DIM}~/.zshrc${RESET}:\n"
|
|
130
|
+
printf "\n"
|
|
131
|
+
printf " export PATH=\"\$PATH:$BIN_DIR\"\n"
|
|
132
|
+
printf "\n"
|
|
133
|
+
;;
|
|
134
|
+
esac
|
|
135
|
+
|
|
136
|
+
# ─── Check optional dependencies ───
|
|
137
|
+
|
|
138
|
+
printf "\n"
|
|
139
|
+
opt_missing=""
|
|
140
|
+
|
|
141
|
+
if ! command -v mpv >/dev/null 2>&1; then
|
|
142
|
+
opt_missing="$opt_missing mpv"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [ -n "$opt_missing" ]; then
|
|
146
|
+
printf "${YELLOW}⚠ Recommended:${RESET}$opt_missing ${DIM}(video player)${RESET}\n"
|
|
147
|
+
printf " ${DIM}Ubuntu/Debian:${RESET} sudo apt install$opt_missing\n"
|
|
148
|
+
printf " ${DIM}Arch:${RESET} sudo pacman -S$opt_missing\n"
|
|
149
|
+
printf " ${DIM}macOS:${RESET} brew install$opt_missing\n"
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# ─── Done ───
|
|
153
|
+
|
|
154
|
+
printf "\n"
|
|
155
|
+
printf "${GREEN}╭────────────────────────────────────────╮${RESET}\n"
|
|
156
|
+
printf "${GREEN}│${RESET} ${WHITE}Installation complete!${RESET} 🎉 ${GREEN}│${RESET}\n"
|
|
157
|
+
printf "${GREEN}├────────────────────────────────────────┤${RESET}\n"
|
|
158
|
+
printf "${GREEN}│${RESET} Run ${CYAN}ny-cli${RESET} to start watching anime ${GREEN}│${RESET}\n"
|
|
159
|
+
printf "${GREEN}│${RESET} Run ${CYAN}ny-cli --help${RESET} for options ${GREEN}│${RESET}\n"
|
|
160
|
+
printf "${GREEN}╰────────────────────────────────────────╯${RESET}\n"
|
|
161
|
+
printf "\n"
|