├── .github ├── DISCUSSION_TEMPLATE.md └── workflows │ └── release.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bin ├── dloadbox-aria2c ├── dloadbox-configurator.sh ├── dloadbox-installer.sh ├── dloadbox-manager.sh └── dloadbox-telegrambot ├── config ├── dloadbox-aria2.conf ├── dloadbox-ariang.conf ├── dloadbox-caddy.conf ├── dloadbox-filebrowser.json ├── dloadbox-telegrambot.conf └── dloadbox.conf ├── dloadbox-info ├── downloads └── LICENSE ├── images ├── 1.JPG ├── 10.JPG ├── 11.JPG ├── 2.JPG ├── 3.JPG ├── 4.JPG ├── 5.JPG ├── 6.JPG ├── 7.JPG ├── 8.JPG └── 9.JPG ├── log ├── dloadbox-aria2-rpc.log └── dloadbox-caddy.log ├── services ├── dloadbox-ariarpc.service ├── dloadbox-caddy.service ├── dloadbox-filebrowser.service ├── dloadbox-telegrambot.service └── dloadbox.service ├── source └── dloadbox-telegrambot.py └── www ├── .gitkeep └── index.html /.github/DISCUSSION_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Discussion Guidelines 2 | 3 | Welcome to the discussion board! To keep things organized and ensure everyone has a productive and respectful experience, please follow these guidelines: 4 | 5 | 1. **Be Respectful**: Treat others with kindness. Disagreeing is okay, but do it politely. 6 | 2. **Stay on Topic**: Keep discussions focused on the category you’re posting in. 7 | 3. **Provide Details**: The more context and information you share, the better others can help or contribute. 8 | 4. **Avoid Spam**: Keep replies meaningful and avoid off-topic promotions. 9 | 5. **Use the Right Template**: Pick the appropriate discussion type (Announcements, Bug Report, General, Ideas, Polls, Q&A, Show and Tell). 10 | 11 | --- 12 | 13 | ## 📢 Announcements 14 | 15 | **Purpose**: Updates from maintainers. 16 | 17 | Stay informed about important changes, updates, or news from the team. 18 | 19 | --- 20 | 21 | ## 🐞 Bug Report 22 | 23 | **Purpose**: Report a bug or unexpected behavior. 24 | 25 | ### Template: 26 | 27 | ```md 28 | ### 🔧 Describe the bug 29 | A clear and concise description of what the bug is. 30 | 31 | ### 🛠️ Steps to reproduce 32 | 1. Go to '...' 33 | 2. Click on '...' 34 | 3. See the error 35 | 36 | ### 💡 Expected behavior 37 | A clear and concise description of what you expected to happen. 38 | 39 | ### 📸 Screenshots (optional) 40 | If applicable, add screenshots to help explain the problem. 41 | 42 | ### 💻 Environment 43 | - OS: [e.g., ubuntu 22] 44 | - Browser: [e.g., Chrome, Firefox] 45 | - Version: [e.g., 1.0.0] 46 | ``` 47 | 48 | --- 49 | 50 | ## 💬 General 51 | 52 | **Purpose**: Chat about anything and everything here. 53 | 54 | For discussions that don't fit into other categories — a free space for open conversation. 55 | 56 | --- 57 | 58 | ## 💡 Ideas 59 | 60 | **Purpose**: Share new feature ideas or improvements. 61 | 62 | ### Template: 63 | 64 | ```md 65 | ### 🌟 What's your idea? 66 | Describe the feature or improvement you’re suggesting. 67 | 68 | ### 🚀 Why would this be helpful? 69 | Explain the benefit or problem it solves. 70 | 71 | ### 🛠️ Possible implementation (optional) 72 | Share any thoughts on how it could be implemented. 73 | ``` 74 | 75 | --- 76 | 77 | ## 📊 Polls 78 | 79 | **Purpose**: Take a vote from the community. 80 | 81 | Create polls to gather opinions and insights from the community. 82 | 83 | --- 84 | 85 | ## 🎯 Q&A (Questions & Answers) 86 | 87 | **Purpose**: Ask the community for help or share knowledge. 88 | 89 | ### Template: 90 | 91 | ```md 92 | ### ❓ Question 93 | What are you trying to achieve or understand? 94 | 95 | ### 🔍 What have you tried so far? 96 | Explain what solutions or steps you've attempted. 97 | 98 | ### 📌 Additional context 99 | Provide extra information, screenshots, or error messages if needed. 100 | ``` 101 | 102 | --- 103 | 104 | ## 🛠️ Show and Tell 105 | 106 | **Purpose**: Share what you’ve built or achieved. 107 | 108 | ### Template: 109 | 110 | ```md 111 | ### 🎉 What did you create? 112 | Describe what you built or accomplished. 113 | 114 | ### 🔥 Why is it awesome? 115 | Explain why you’re proud of it or what makes it useful. 116 | 117 | ### 🖼️ Screenshots or demo link (optional) 118 | Include a link or image showcasing your work. 119 | ``` 120 | 121 | --- 122 | 123 | Happy discussing! 🚀 -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release Automation 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: write 10 | id-token: write 11 | 12 | jobs: 13 | create-release: 14 | runs-on: ubuntu-22.04 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v3 18 | 19 | - name: Install dependencies 20 | run: | 21 | sudo apt update && sudo apt install -y patchelf zip 22 | python3 -m pip install --upgrade pip 23 | pip install nuitka==2.6.7 python-telegram-bot requests 24 | 25 | 26 | - name: Extract version number 27 | id: extract_version 28 | run: | 29 | VERSION=$(grep VERSION_DLOADBOX bin/dloadbox-installer.sh | head -n 1 | awk -F '"' '{print $2}') 30 | echo "VERSION=$VERSION" >> $GITHUB_ENV 31 | 32 | # - name: Find Telegram package path 33 | # id: find_telegram_path 34 | # run: | 35 | # TELEGRAM_PATH=$(python3 -c "import telegram; print(telegram.__path__[0])") 36 | # echo "TELEGRAM_PATH=$TELEGRAM_PATH" >> $GITHUB_ENV 37 | # echo "Found Telegram package at: $TELEGRAM_PATH" 38 | # 39 | # - name: Build binary with Nuitka 40 | # run: | 41 | # mkdir -p build_output 42 | # nuitka --standalone --onefile \ 43 | # --include-package=requests \ 44 | # --include-package=logging \ 45 | # --include-package=os \ 46 | # --include-package=telegram \ 47 | # --include-data-dir=$TELEGRAM_PATH=telegram \ 48 | # --output-dir=build_output source/dloadbox-telegrambot.py 49 | # mv build_output/dloadbox-telegrambot.bin bin/dloadbox-telegrambot 50 | # rm -rf build_output 51 | 52 | - name: Create release notes 53 | id: generate_notes 54 | run: | 55 | echo "# Version: $VERSION" > release_notes.md 56 | echo "## Installation" >> release_notes.md 57 | echo "\`\`\`bash" >> release_notes.md 58 | echo "wget https://github.com/${{ github.repository }}/releases/download/$VERSION/dloadbox-installer.sh" >> release_notes.md 59 | echo "chmod +x dloadbox-installer.sh" >> release_notes.md 60 | echo "./dloadbox-installer.sh" >> release_notes.md 61 | echo "\`\`\`" >> release_notes.md 62 | 63 | - name: Create dloadbox.zip 64 | run: | 65 | zip -r dloadbox.zip . -x ".git/*" ".github/*" "release_notes.md" "images/*" 66 | 67 | - name: Create release 68 | uses: softprops/action-gh-release@v1 69 | with: 70 | name: ${{ env.VERSION }} 71 | tag_name: ${{ env.VERSION }} 72 | body_path: ./release_notes.md 73 | files: | 74 | bin/dloadbox-installer.sh 75 | dloadbox.zip 76 | env: 77 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 78 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | idea/ -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 🚀 Contribution Guide 2 | 3 | Thank you for considering contributing to this project! 4 | However, forking this project requires prior approval from the maintainer. 5 | 6 | ## 🔒 Forking Policy 7 | If you want to fork this repository: 8 | 1. Open an issue explaining **why** you need to fork the project. 9 | 2. Wait for approval from the maintainer. 10 | 3. Once approved, feel free to fork and contribute! 11 | 12 | Unauthorized forks may be reported or ignored. 13 | 14 | Thank you for respecting this policy! 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Forking Policy: 2 | Before forking this project, you must obtain prior written permission from the maintainer. 3 | Unauthorized forks may be reported or ignored. Please refer to the [CONTRIBUTING.md](./CONTRIBUTING.md) for more details. 4 | 5 | 6 | GNU GENERAL PUBLIC LICENSE 7 | Version 3, 29 June 2007 8 | 9 | Copyright (C) 2007 Free Software Foundation, Inc. 10 | Everyone is permitted to copy and distribute verbatim copies 11 | of this license document, but changing it is not allowed. 12 | 13 | Preamble 14 | 15 | The GNU General Public License is a free, copyleft license for 16 | software and other kinds of works. 17 | 18 | The licenses for most software and other practical works are designed 19 | to take away your freedom to share and change the works. By contrast, 20 | the GNU General Public License is intended to guarantee your freedom to 21 | share and change all versions of a program--to make sure it remains free 22 | software for all its users. We, the Free Software Foundation, use the 23 | GNU General Public License for most of our software; it applies also to 24 | any other work released this way by its authors. You can apply it to 25 | your programs, too. 26 | 27 | When we speak of free software, we are referring to freedom, not 28 | price. Our General Public Licenses are designed to make sure that you 29 | have the freedom to distribute copies of free software (and charge for 30 | them if you wish), that you receive source code or can get it if you 31 | want it, that you can change the software or use pieces of it in new 32 | free programs, and that you know you can do these things. 33 | 34 | To protect your rights, we need to prevent others from denying you 35 | these rights or asking you to surrender the rights. Therefore, you have 36 | certain responsibilities if you distribute copies of the software, or if 37 | you modify it: responsibilities to respect the freedom of others. 38 | 39 | For example, if you distribute copies of such a program, whether 40 | gratis or for a fee, you must pass on to the recipients the same 41 | freedoms that you received. You must make sure that they, too, receive 42 | or can get the source code. And you must show them these terms so they 43 | know their rights. 44 | 45 | Developers that use the GNU GPL protect your rights with two steps: 46 | (1) assert copyright on the software, and (2) offer you this License 47 | giving you legal permission to copy, distribute and/or modify it. 48 | 49 | For the developers' and authors' protection, the GPL clearly explains 50 | that there is no warranty for this free software. For both users' and 51 | authors' sake, the GPL requires that modified versions be marked as 52 | changed, so that their problems will not be attributed erroneously to 53 | authors of previous versions. 54 | 55 | Some devices are designed to deny users access to install or run 56 | modified versions of the software inside them, although the manufacturer 57 | can do so. This is fundamentally incompatible with the aim of 58 | protecting users' freedom to change the software. The systematic 59 | pattern of such abuse occurs in the area of products for individuals to 60 | use, which is precisely where it is most unacceptable. Therefore, we 61 | have designed this version of the GPL to prohibit the practice for those 62 | products. If such problems arise substantially in other domains, we 63 | stand ready to extend this provision to those domains in future versions 64 | of the GPL, as needed to protect the freedom of users. 65 | 66 | Finally, every program is threatened constantly by software patents. 67 | States should not allow patents to restrict development and use of 68 | software on general-purpose computers, but in those that do, we wish to 69 | avoid the special danger that patents applied to a free program could 70 | make it effectively proprietary. To prevent this, the GPL assures that 71 | patents cannot be used to render the program non-free. 72 | 73 | The precise terms and conditions for copying, distribution and 74 | modification follow. 75 | 76 | TERMS AND CONDITIONS 77 | 78 | 0. Definitions. 79 | 80 | "This License" refers to version 3 of the GNU General Public License. 81 | 82 | "Copyright" also means copyright-like laws that apply to other kinds of 83 | works, such as semiconductor masks. 84 | 85 | "The Program" refers to any copyrightable work licensed under this 86 | License. Each licensee is addressed as "you". "Licensees" and 87 | "recipients" may be individuals or organizations. 88 | 89 | To "modify" a work means to copy from or adapt all or part of the work 90 | in a fashion requiring copyright permission, other than the making of an 91 | exact copy. The resulting work is called a "modified version" of the 92 | earlier work or a work "based on" the earlier work. 93 | 94 | A "covered work" means either the unmodified Program or a work based 95 | on the Program. 96 | 97 | To "propagate" a work means to do anything with it that, without 98 | permission, would make you directly or secondarily liable for 99 | infringement under applicable copyright law, except executing it on a 100 | computer or modifying a private copy. Propagation includes copying, 101 | distribution (with or without modification), making available to the 102 | public, and in some countries other activities as well. 103 | 104 | To "convey" a work means any kind of propagation that enables other 105 | parties to make or receive copies. Mere interaction with a user through 106 | a computer network, with no transfer of a copy, is not conveying. 107 | 108 | An interactive user interface displays "Appropriate Legal Notices" 109 | to the extent that it includes a convenient and prominently visible 110 | feature that (1) displays an appropriate copyright notice, and (2) 111 | tells the user that there is no warranty for the work (except to the 112 | extent that warranties are provided), that licensees may convey the 113 | work under this License, and how to view a copy of this License. If 114 | the interface presents a list of user commands or options, such as a 115 | menu, a prominent item in the list meets this criterion. 116 | 117 | 1. Source Code. 118 | 119 | The "source code" for a work means the preferred form of the work 120 | for making modifications to it. "Object code" means any non-source 121 | form of a work. 122 | 123 | A "Standard Interface" means an interface that either is an official 124 | standard defined by a recognized standards body, or, in the case of 125 | interfaces specified for a particular programming language, one that 126 | is widely used among developers working in that language. 127 | 128 | The "System Libraries" of an executable work include anything, other 129 | than the work as a whole, that (a) is included in the normal form of 130 | packaging a Major Component, but which is not part of that Major 131 | Component, and (b) serves only to enable use of the work with that 132 | Major Component, or to implement a Standard Interface for which an 133 | implementation is available to the public in source code form. A 134 | "Major Component", in this context, means a major essential component 135 | (kernel, window system, and so on) of the specific operating system 136 | (if any) on which the executable work runs, or a compiler used to 137 | produce the work, or an object code interpreter used to run it. 138 | 139 | The "Corresponding Source" for a work in object code form means all 140 | the source code needed to generate, install, and (for an executable 141 | work) run the object code and to modify the work, including scripts to 142 | control those activities. However, it does not include the work's 143 | System Libraries, or general-purpose tools or generally available free 144 | programs which are used unmodified in performing those activities but 145 | which are not part of the work. For example, Corresponding Source 146 | includes interface definition files associated with source files for 147 | the work, and the source code for shared libraries and dynamically 148 | linked subprograms that the work is specifically designed to require, 149 | such as by intimate data communication or control flow between those 150 | subprograms and other parts of the work. 151 | 152 | The Corresponding Source need not include anything that users 153 | can regenerate automatically from other parts of the Corresponding 154 | Source. 155 | 156 | The Corresponding Source for a work in source code form is that 157 | same work. 158 | 159 | 2. Basic Permissions. 160 | 161 | All rights granted under this License are granted for the term of 162 | copyright on the Program, and are irrevocable provided the stated 163 | conditions are met. This License explicitly affirms your unlimited 164 | permission to run the unmodified Program. The output from running a 165 | covered work is covered by this License only if the output, given its 166 | content, constitutes a covered work. This License acknowledges your 167 | rights of fair use or other equivalent, as provided by copyright law. 168 | 169 | You may make, run and propagate covered works that you do not 170 | convey, without conditions so long as your license otherwise remains 171 | in force. You may convey covered works to others for the sole purpose 172 | of having them make modifications exclusively for you, or provide you 173 | with facilities for running those works, provided that you comply with 174 | the terms of this License in conveying all material for which you do 175 | not control copyright. Those thus making or running the covered works 176 | for you must do so exclusively on your behalf, under your direction 177 | and control, on terms that prohibit them from making any copies of 178 | your copyrighted material outside their relationship with you. 179 | 180 | Conveying under any other circumstances is permitted solely under 181 | the conditions stated below. Sublicensing is not allowed; section 10 182 | makes it unnecessary. 183 | 184 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 185 | 186 | No covered work shall be deemed part of an effective technological 187 | measure under any applicable law fulfilling obligations under article 188 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 189 | similar laws prohibiting or restricting circumvention of such 190 | measures. 191 | 192 | When you convey a covered work, you waive any legal power to forbid 193 | circumvention of technological measures to the extent such circumvention 194 | is effected by exercising rights under this License with respect to 195 | the covered work, and you disclaim any intention to limit operation or 196 | modification of the work as a means of enforcing, against the work's 197 | users, your or third parties' legal rights to forbid circumvention of 198 | technological measures. 199 | 200 | 4. Conveying Verbatim Copies. 201 | 202 | You may convey verbatim copies of the Program's source code as you 203 | receive it, in any medium, provided that you conspicuously and 204 | appropriately publish on each copy an appropriate copyright notice; 205 | keep intact all notices stating that this License and any 206 | non-permissive terms added in accord with section 7 apply to the code; 207 | keep intact all notices of the absence of any warranty; and give all 208 | recipients a copy of this License along with the Program. 209 | 210 | You may charge any price or no price for each copy that you convey, 211 | and you may offer support or warranty protection for a fee. 212 | 213 | 5. Conveying Modified Source Versions. 214 | 215 | You may convey a work based on the Program, or the modifications to 216 | produce it from the Program, in the form of source code under the 217 | terms of section 4, provided that you also meet all of these conditions: 218 | 219 | a) The work must carry prominent notices stating that you modified 220 | it, and giving a relevant date. 221 | 222 | b) The work must carry prominent notices stating that it is 223 | released under this License and any conditions added under section 224 | 7. This requirement modifies the requirement in section 4 to 225 | "keep intact all notices". 226 | 227 | c) You must license the entire work, as a whole, under this 228 | License to anyone who comes into possession of a copy. This 229 | License will therefore apply, along with any applicable section 7 230 | additional terms, to the whole of the work, and all its parts, 231 | regardless of how they are packaged. This License gives no 232 | permission to license the work in any other way, but it does not 233 | invalidate such permission if you have separately received it. 234 | 235 | d) If the work has interactive user interfaces, each must display 236 | Appropriate Legal Notices; however, if the Program has interactive 237 | interfaces that do not display Appropriate Legal Notices, your 238 | work need not make them do so. 239 | 240 | A compilation of a covered work with other separate and independent 241 | works, which are not by their nature extensions of the covered work, 242 | and which are not combined with it such as to form a larger program, 243 | in or on a volume of a storage or distribution medium, is called an 244 | "aggregate" if the compilation and its resulting copyright are not 245 | used to limit the access or legal rights of the compilation's users 246 | beyond what the individual works permit. Inclusion of a covered work 247 | in an aggregate does not cause this License to apply to the other 248 | parts of the aggregate. 249 | 250 | 6. Conveying Non-Source Forms. 251 | 252 | You may convey a covered work in object code form under the terms 253 | of sections 4 and 5, provided that you also convey the 254 | machine-readable Corresponding Source under the terms of this License, 255 | in one of these ways: 256 | 257 | a) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by the 259 | Corresponding Source fixed on a durable physical medium 260 | customarily used for software interchange. 261 | 262 | b) Convey the object code in, or embodied in, a physical product 263 | (including a physical distribution medium), accompanied by a 264 | written offer, valid for at least three years and valid for as 265 | long as you offer spare parts or customer support for that product 266 | model, to give anyone who possesses the object code either (1) a 267 | copy of the Corresponding Source for all the software in the 268 | product that is covered by this License, on a durable physical 269 | medium customarily used for software interchange, for a price no 270 | more than your reasonable cost of physically performing this 271 | conveying of source, or (2) access to copy the 272 | Corresponding Source from a network server at no charge. 273 | 274 | c) Convey individual copies of the object code with a copy of the 275 | written offer to provide the Corresponding Source. This 276 | alternative is allowed only occasionally and noncommercially, and 277 | only if you received the object code with such an offer, in accord 278 | with subsection 6b. 279 | 280 | d) Convey the object code by offering access from a designated 281 | place (gratis or for a charge), and offer equivalent access to the 282 | Corresponding Source in the same way through the same place at no 283 | further charge. You need not require recipients to copy the 284 | Corresponding Source along with the object code. If the place to 285 | copy the object code is a network server, the Corresponding Source 286 | may be on a different server (operated by you or a third party) 287 | that supports equivalent copying facilities, provided you maintain 288 | clear directions next to the object code saying where to find the 289 | Corresponding Source. Regardless of what server hosts the 290 | Corresponding Source, you remain obligated to ensure that it is 291 | available for as long as needed to satisfy these requirements. 292 | 293 | e) Convey the object code using peer-to-peer transmission, provided 294 | you inform other peers where the object code and Corresponding 295 | Source of the work are being offered to the general public at no 296 | charge under subsection 6d. 297 | 298 | A separable portion of the object code, whose source code is excluded 299 | from the Corresponding Source as a System Library, need not be 300 | included in conveying the object code work. 301 | 302 | A "User Product" is either (1) a "consumer product", which means any 303 | tangible personal property which is normally used for personal, family, 304 | or household purposes, or (2) anything designed or sold for incorporation 305 | into a dwelling. In determining whether a product is a consumer product, 306 | doubtful cases shall be resolved in favor of coverage. For a particular 307 | product received by a particular user, "normally used" refers to a 308 | typical or common use of that class of product, regardless of the status 309 | of the particular user or of the way in which the particular user 310 | actually uses, or expects or is expected to use, the product. A product 311 | is a consumer product regardless of whether the product has substantial 312 | commercial, industrial or non-consumer uses, unless such uses represent 313 | the only significant mode of use of the product. 314 | 315 | "Installation Information" for a User Product means any methods, 316 | procedures, authorization keys, or other information required to install 317 | and execute modified versions of a covered work in that User Product from 318 | a modified version of its Corresponding Source. The information must 319 | suffice to ensure that the continued functioning of the modified object 320 | code is in no case prevented or interfered with solely because 321 | modification has been made. 322 | 323 | If you convey an object code work under this section in, or with, or 324 | specifically for use in, a User Product, and the conveying occurs as 325 | part of a transaction in which the right of possession and use of the 326 | User Product is transferred to the recipient in perpetuity or for a 327 | fixed term (regardless of how the transaction is characterized), the 328 | Corresponding Source conveyed under this section must be accompanied 329 | by the Installation Information. But this requirement does not apply 330 | if neither you nor any third party retains the ability to install 331 | modified object code on the User Product (for example, the work has 332 | been installed in ROM). 333 | 334 | The requirement to provide Installation Information does not include a 335 | requirement to continue to provide support service, warranty, or updates 336 | for a work that has been modified or installed by the recipient, or for 337 | the User Product in which it has been modified or installed. Access to a 338 | network may be denied when the modification itself materially and 339 | adversely affects the operation of the network or violates the rules and 340 | protocols for communication across the network. 341 | 342 | Corresponding Source conveyed, and Installation Information provided, 343 | in accord with this section must be in a format that is publicly 344 | documented (and with an implementation available to the public in 345 | source code form), and must require no special password or key for 346 | unpacking, reading or copying. 347 | 348 | 7. Additional Terms. 349 | 350 | "Additional permissions" are terms that supplement the terms of this 351 | License by making exceptions from one or more of its conditions. 352 | Additional permissions that are applicable to the entire Program shall 353 | be treated as though they were included in this License, to the extent 354 | that they are valid under applicable law. If additional permissions 355 | apply only to part of the Program, that part may be used separately 356 | under those permissions, but the entire Program remains governed by 357 | this License without regard to the additional permissions. 358 | 359 | When you convey a copy of a covered work, you may at your option 360 | remove any additional permissions from that copy, or from any part of 361 | it. (Additional permissions may be written to require their own 362 | removal in certain cases when you modify the work.) You may place 363 | additional permissions on material, added by you to a covered work, 364 | for which you have or can give appropriate copyright permission. 365 | 366 | Notwithstanding any other provision of this License, for material you 367 | add to a covered work, you may (if authorized by the copyright holders of 368 | that material) supplement the terms of this License with terms: 369 | 370 | a) Disclaiming warranty or limiting liability differently from the 371 | terms of sections 15 and 16 of this License; or 372 | 373 | b) Requiring preservation of specified reasonable legal notices or 374 | author attributions in that material or in the Appropriate Legal 375 | Notices displayed by works containing it; or 376 | 377 | c) Prohibiting misrepresentation of the origin of that material, or 378 | requiring that modified versions of such material be marked in 379 | reasonable ways as different from the original version; or 380 | 381 | d) Limiting the use for publicity purposes of names of licensors or 382 | authors of the material; or 383 | 384 | e) Declining to grant rights under trademark law for use of some 385 | trade names, trademarks, or service marks; or 386 | 387 | f) Requiring indemnification of licensors and authors of that 388 | material by anyone who conveys the material (or modified versions of 389 | it) with contractual assumptions of liability to the recipient, for 390 | any liability that these contractual assumptions directly impose on 391 | those licensors and authors. 392 | 393 | All other non-permissive additional terms are considered "further 394 | restrictions" within the meaning of section 10. If the Program as you 395 | received it, or any part of it, contains a notice stating that it is 396 | governed by this License along with a term that is a further 397 | restriction, you may remove that term. If a license document contains 398 | a further restriction but permits relicensing or conveying under this 399 | License, you may add to a covered work material governed by the terms 400 | of that license document, provided that the further restriction does 401 | not survive such relicensing or conveying. 402 | 403 | If you add terms to a covered work in accord with this section, you 404 | must place, in the relevant source files, a statement of the 405 | additional terms that apply to those files, or a notice indicating 406 | where to find the applicable terms. 407 | 408 | Additional terms, permissive or non-permissive, may be stated in the 409 | form of a separately written license, or stated as exceptions; 410 | the above requirements apply either way. 411 | 412 | 8. Termination. 413 | 414 | You may not propagate or modify a covered work except as expressly 415 | provided under this License. Any attempt otherwise to propagate or 416 | modify it is void, and will automatically terminate your rights under 417 | this License (including any patent licenses granted under the third 418 | paragraph of section 11). 419 | 420 | However, if you cease all violation of this License, then your 421 | license from a particular copyright holder is reinstated (a) 422 | provisionally, unless and until the copyright holder explicitly and 423 | finally terminates your license, and (b) permanently, if the copyright 424 | holder fails to notify you of the violation by some reasonable means 425 | prior to 60 days after the cessation. 426 | 427 | Moreover, your license from a particular copyright holder is 428 | reinstated permanently if the copyright holder notifies you of the 429 | violation by some reasonable means, this is the first time you have 430 | received notice of violation of this License (for any work) from that 431 | copyright holder, and you cure the violation prior to 30 days after 432 | your receipt of the notice. 433 | 434 | Termination of your rights under this section does not terminate the 435 | licenses of parties who have received copies or rights from you under 436 | this License. If your rights have been terminated and not permanently 437 | reinstated, you do not qualify to receive new licenses for the same 438 | material under section 10. 439 | 440 | 9. Acceptance Not Required for Having Copies. 441 | 442 | You are not required to accept this License in order to receive or 443 | run a copy of the Program. Ancillary propagation of a covered work 444 | occurring solely as a consequence of using peer-to-peer transmission 445 | to receive a copy likewise does not require acceptance. However, 446 | nothing other than this License grants you permission to propagate or 447 | modify any covered work. These actions infringe copyright if you do 448 | not accept this License. Therefore, by modifying or propagating a 449 | covered work, you indicate your acceptance of this License to do so. 450 | 451 | 10. Automatic Licensing of Downstream Recipients. 452 | 453 | Each time you convey a covered work, the recipient automatically 454 | receives a license from the original licensors, to run, modify and 455 | propagate that work, subject to this License. You are not responsible 456 | for enforcing compliance by third parties with this License. 457 | 458 | An "entity transaction" is a transaction transferring control of an 459 | organization, or substantially all assets of one, or subdividing an 460 | organization, or merging organizations. If propagation of a covered 461 | work results from an entity transaction, each party to that 462 | transaction who receives a copy of the work also receives whatever 463 | licenses to the work the party's predecessor in interest had or could 464 | give under the previous paragraph, plus a right to possession of the 465 | Corresponding Source of the work from the predecessor in interest, if 466 | the predecessor has it or can get it with reasonable efforts. 467 | 468 | You may not impose any further restrictions on the exercise of the 469 | rights granted or affirmed under this License. For example, you may 470 | not impose a license fee, royalty, or other charge for exercise of 471 | rights granted under this License, and you may not initiate litigation 472 | (including a cross-claim or counterclaim in a lawsuit) alleging that 473 | any patent claim is infringed by making, using, selling, offering for 474 | sale, or importing the Program or any portion of it. 475 | 476 | 11. Patents. 477 | 478 | A "contributor" is a copyright holder who authorizes use under this 479 | License of the Program or a work on which the Program is based. The 480 | work thus licensed is called the contributor's "contributor version". 481 | 482 | A contributor's "essential patent claims" are all patent claims 483 | owned or controlled by the contributor, whether already acquired or 484 | hereafter acquired, that would be infringed by some manner, permitted 485 | by this License, of making, using, or selling its contributor version, 486 | but do not include claims that would be infringed only as a 487 | consequence of further modification of the contributor version. For 488 | purposes of this definition, "control" includes the right to grant 489 | patent sublicenses in a manner consistent with the requirements of 490 | this License. 491 | 492 | Each contributor grants you a non-exclusive, worldwide, royalty-free 493 | patent license under the contributor's essential patent claims, to 494 | make, use, sell, offer for sale, import and otherwise run, modify and 495 | propagate the contents of its contributor version. 496 | 497 | In the following three paragraphs, a "patent license" is any express 498 | agreement or commitment, however denominated, not to enforce a patent 499 | (such as an express permission to practice a patent or covenant not to 500 | sue for patent infringement). To "grant" such a patent license to a 501 | party means to make such an agreement or commitment not to enforce a 502 | patent against the party. 503 | 504 | If you convey a covered work, knowingly relying on a patent license, 505 | and the Corresponding Source of the work is not available for anyone 506 | to copy, free of charge and under the terms of this License, through a 507 | publicly available network server or other readily accessible means, 508 | then you must either (1) cause the Corresponding Source to be so 509 | available, or (2) arrange to deprive yourself of the benefit of the 510 | patent license for this particular work, or (3) arrange, in a manner 511 | consistent with the requirements of this License, to extend the patent 512 | license to downstream recipients. "Knowingly relying" means you have 513 | actual knowledge that, but for the patent license, your conveying the 514 | covered work in a country, or your recipient's use of the covered work 515 | in a country, would infringe one or more identifiable patents in that 516 | country that you have reason to believe are valid. 517 | 518 | If, pursuant to or in connection with a single transaction or 519 | arrangement, you convey, or propagate by procuring conveyance of, a 520 | covered work, and grant a patent license to some of the parties 521 | receiving the covered work authorizing them to use, propagate, modify 522 | or convey a specific copy of the covered work, then the patent license 523 | you grant is automatically extended to all recipients of the covered 524 | work and works based on it. 525 | 526 | A patent license is "discriminatory" if it does not include within 527 | the scope of its coverage, prohibits the exercise of, or is 528 | conditioned on the non-exercise of one or more of the rights that are 529 | specifically granted under this License. You may not convey a covered 530 | work if you are a party to an arrangement with a third party that is 531 | in the business of distributing software, under which you make payment 532 | to the third party based on the extent of your activity of conveying 533 | the work, and under which the third party grants, to any of the 534 | parties who would receive the covered work from you, a discriminatory 535 | patent license (a) in connection with copies of the covered work 536 | conveyed by you (or copies made from those copies), or (b) primarily 537 | for and in connection with specific products or compilations that 538 | contain the covered work, unless you entered into that arrangement, 539 | or that patent license was granted, prior to 28 March 2007. 540 | 541 | Nothing in this License shall be construed as excluding or limiting 542 | any implied license or other defenses to infringement that may 543 | otherwise be available to you under applicable patent law. 544 | 545 | 12. No Surrender of Others' Freedom. 546 | 547 | If conditions are imposed on you (whether by court order, agreement or 548 | otherwise) that contradict the conditions of this License, they do not 549 | excuse you from the conditions of this License. If you cannot convey a 550 | covered work so as to satisfy simultaneously your obligations under this 551 | License and any other pertinent obligations, then as a consequence you may 552 | not convey it at all. For example, if you agree to terms that obligate you 553 | to collect a royalty for further conveying from those to whom you convey 554 | the Program, the only way you could satisfy both those terms and this 555 | License would be to refrain entirely from conveying the Program. 556 | 557 | 13. Use with the GNU Affero General Public License. 558 | 559 | Notwithstanding any other provision of this License, you have 560 | permission to link or combine any covered work with a work licensed 561 | under version 3 of the GNU Affero General Public License into a single 562 | combined work, and to convey the resulting work. The terms of this 563 | License will continue to apply to the part which is the covered work, 564 | but the special requirements of the GNU Affero General Public License, 565 | section 13, concerning interaction through a network will apply to the 566 | combination as such. 567 | 568 | 14. Revised Versions of this License. 569 | 570 | The Free Software Foundation may publish revised and/or new versions of 571 | the GNU General Public License from time to time. Such new versions will 572 | be similar in spirit to the present version, but may differ in detail to 573 | address new problems or concerns. 574 | 575 | Each version is given a distinguishing version number. If the 576 | Program specifies that a certain numbered version of the GNU General 577 | Public License "or any later version" applies to it, you have the 578 | option of following the terms and conditions either of that numbered 579 | version or of any later version published by the Free Software 580 | Foundation. If the Program does not specify a version number of the 581 | GNU General Public License, you may choose any version ever published 582 | by the Free Software Foundation. 583 | 584 | If the Program specifies that a proxy can decide which future 585 | versions of the GNU General Public License can be used, that proxy's 586 | public statement of acceptance of a version permanently authorizes you 587 | to choose that version for the Program. 588 | 589 | Later license versions may give you additional or different 590 | permissions. However, no additional obligations are imposed on any 591 | author or copyright holder as a result of your choosing to follow a 592 | later version. 593 | 594 | 15. Disclaimer of Warranty. 595 | 596 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 597 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 598 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 599 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 600 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 601 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 602 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 603 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 604 | 605 | 16. Limitation of Liability. 606 | 607 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 608 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 609 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 610 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 611 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 612 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 613 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 614 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 615 | SUCH DAMAGES. 616 | 617 | 17. Interpretation of Sections 15 and 16. 618 | 619 | If the disclaimer of warranty and limitation of liability provided 620 | above cannot be given local legal effect according to their terms, 621 | reviewing courts shall apply local law that most closely approximates 622 | an absolute waiver of all civil liability in connection with the 623 | Program, unless a warranty or assumption of liability accompanies a 624 | copy of the Program in return for a fee. 625 | 626 | END OF TERMS AND CONDITIONS 627 | 628 | How to Apply These Terms to Your New Programs 629 | 630 | If you develop a new program, and you want it to be of the greatest 631 | possible use to the public, the best way to achieve this is to make it 632 | free software which everyone can redistribute and change under these terms. 633 | 634 | To do so, attach the following notices to the program. It is safest 635 | to attach them to the start of each source file to most effectively 636 | state the exclusion of warranty; and each file should have at least 637 | the "copyright" line and a pointer to where the full notice is found. 638 | 639 | 640 | Copyright (C) 641 | 642 | This program is free software: you can redistribute it and/or modify 643 | it under the terms of the GNU General Public License as published by 644 | the Free Software Foundation, either version 3 of the License, or 645 | (at your option) any later version. 646 | 647 | This program is distributed in the hope that it will be useful, 648 | but WITHOUT ANY WARRANTY; without even the implied warranty of 649 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 650 | GNU General Public License for more details. 651 | 652 | You should have received a copy of the GNU General Public License 653 | along with this program. If not, see . 654 | 655 | Also add information on how to contact you by electronic and paper mail. 656 | 657 | If the program does terminal interaction, make it output a short 658 | notice like this when it starts in an interactive mode: 659 | 660 | Copyright (C) 661 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 662 | This is free software, and you are welcome to redistribute it 663 | under certain conditions; type `show c' for details. 664 | 665 | The hypothetical commands `show w' and `show c' should show the appropriate 666 | parts of the General Public License. Of course, your program's commands 667 | might be different; for a GUI interface, you would use an "about box". 668 | 669 | You should also get your employer (if you work as a programmer) or school, 670 | if any, to sign a "copyright disclaimer" for the program, if necessary. 671 | For more information on this, and how to apply and follow the GNU GPL, see 672 | . 673 | 674 | The GNU General Public License does not permit incorporating your program 675 | into proprietary programs. If your program is a subroutine library, you 676 | may consider it more useful to permit linking proprietary applications with 677 | the library. If this is what you want to do, use the GNU Lesser General 678 | Public License instead of this License. But first, please read 679 | . 680 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | ██████╗ ██╗ ██████╗ █████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗ 3 | ██╔══██╗██║ ██╔═══██╗██╔══██╗██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝ 4 | ██║ ██║██║ ██║ ██║███████║██║ ██║██████╔╝██║ ██║ ╚███╔╝ 5 | ██║ ██║██║ ██║ ██║██╔══██║██║ ██║██╔══██╗██║ ██║ ██╔██╗ 6 | ██████╔╝███████╗╚██████╔╝██║ ██║██████╔╝██████╔╝╚██████╔╝██╔╝ ██╗ 7 | ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ 8 | Full Download and File Manager Platform 9 | ‌by A.ZOLFAGHAR 10 | 11 | ``` 12 | # DloadBox 13 | DloadBox is a complete download management platform combining aria2c, Caddy, ariaNG, RPC integration, and a Telegram bot. It offers a user-friendly web interface and remote control, enabling efficient and scalable management of downloads from anywhere. 14 | 15 | # Screenshots 16 | 17 |

18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 | 31 | # Coming soon... 32 | # DloadBox - Alpha Version Installer 33 | 34 | We are approaching the launch of the first version of DloadBox! For now, enthusiasts can install and use the Alpha version with this installer without any issues. 35 | 36 | Currently, it has been tested only on Ubuntu, but it is designed for all 64-bit Linux distributions. Feel free to test it on your Linux systems and open issues if you encounter any problems or have feature requests. 37 | 38 | 39 | 40 | ## Installation Instructions: 41 | 42 | Download and Run the installer using the following commands: 43 | 44 | ``` 45 | wget https://github.com/azolfagharj/DloadBox/releases/latest/download/dloadbox-installer.sh && \ 46 | chmod +x dloadbox-installer.sh && \ 47 | ./dloadbox-installer.sh 48 | 49 | ``` 50 | That's it! The installer will handle everything for you automatically. 51 | 52 | ## 🚫 Forking Policy 53 | 54 | Before forking this project, please read the [Contribution Guide](./CONTRIBUTING.md). 55 | Forking without prior approval is not allowed. 56 | 57 | 58 | ## Open-Source Software Used in This Project 59 | 60 | This platform utilizes various open-source projects to provide its core functionalities. Below is a list of the software used, along with their respective licenses and purposes: 61 | 62 | - **[Caddy](https://github.com/caddyserver/caddy)** – Used as the web server. 63 | - **License**: [Apache License 2.0](https://github.com/caddyserver/caddy/blob/master/LICENSE) 64 | 65 | - **[aria2](https://github.com/aria2/aria2)** – Used as the download manager. 66 | - **License**: [GNU General Public License (GPL) v2](https://github.com/aria2/aria2/blob/master/COPYING) 67 | 68 | - **[aria2-static-builds](https://git.q3aql.dev/q3aql/aria2-static-builds)** – Prebuilt static binaries of aria2 used for easier deployment. 69 | - **License**: [GNU General Public License (GPL) v2](https://github.com/aria2/aria2/blob/master/COPYING) 70 | 71 | - **[AriaNg](https://github.com/mayswind/AriaNg)** – A web-based frontend for aria2. 72 | - **License**: [MIT License](https://github.com/mayswind/AriaNg/blob/master/LICENSE) 73 | 74 | - **[File Browser](https://github.com/filebrowser/filebrowser)** – Used as the file manager to browse and manage downloaded files. 75 | - **License**: [Apache License 2.0](https://github.com/filebrowser/filebrowser/blob/main/LICENSE) -------------------------------------------------------------------------------- /bin/dloadbox-aria2c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/bin/dloadbox-aria2c -------------------------------------------------------------------------------- /bin/dloadbox-configurator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # DloadBox Configurator 3 | # Use to configure DloadBox service based on dloadbox.conf file. 4 | # DloadBox is a complete download management platform combining aria2c, Lighttpd, ariaNG, RPC integration, and a Telegram bot. 5 | # It offers a user-friendly web interface and remote control, enabling efficient and scalable management of downloads from anywhere. 6 | 7 | # Version info 8 | VERSION_DLOADBOX="alpha-2.2.9" 9 | VERSION_DLOADBOX_CREATE="2024-12-01" 10 | VERSION_DLOADBOX_UPDATE="2025-04-17" 11 | init_variables(){ 12 | #region URL 13 | # ################################################################################## # 14 | # # URL # # 15 | # ################################################################################## # 16 | # DloadBox URL 17 | URL_DLOADBOX_GITHUB="https://github.com/azolfaghar/dloadbox" 18 | URL_DLOADBOX_GITHUB_ISSUES="https://github.com/azolfaghar/dloadbox/issues" 19 | URL_DLOADBOX_LATEST_ZIP="https://github.com/azolfagharj/DloadBox/releases/download/$VERSION_DLOADBOX/dloadbox.zip" 20 | URL_FILEBROWSER_TARGZ="https://github.com/filebrowser/filebrowser/releases/download/v$VERSION_FILEBROWSER/linux-amd64-filebrowser.tar.gz" 21 | URL_ARIANG_ZIP="https://github.com/mayswind/AriaNg/releases/download/$VERSION_ARIANG/AriaNg-$VERSION_ARIANG.zip" 22 | URL_CADDY_TARGZ="https://github.com/caddyserver/caddy/releases/download/v$VERSION_CADDY/caddy_${VERSION_CADDY}_linux_amd64.tar.gz" 23 | #endregion 24 | #region hierarchy 25 | # ################################################################################## # 26 | # # DloadBox Hierarchy # # 27 | # ################################################################################## # 28 | # Info file 29 | file_dloadbox_info="/opt/dloadbox/dloadbox-info" 30 | # Config files 31 | file_config_aria2="/opt/dloadbox/config/dloadbox-aria2.conf" 32 | file_config_ariang="/opt/dloadbox/config/dloadbox-ariang.conf" 33 | file_config_webserver="/opt/dloadbox/config/dloadbox-caddy.conf" 34 | file_config_telegram_bot="/opt/dloadbox/config/dloadbox-telegrambot.conf" 35 | file_config_filebrowser_json="/opt/dloadbox/config/dloadbox-filebrowser.json" 36 | file_config_filebrowser_db="/opt/dloadbox/config/dloadbox-filebrowser.db" 37 | file_config_dloadbox="/opt/dloadbox/config/dloadbox.conf" 38 | # Services files 39 | file_service_dloadbox="/opt/dloadbox/services/dloadbox.service" 40 | file_service_ariarpc="/opt/dloadbox/services/dloadbox-ariarpc.service" 41 | file_service_webserver="/opt/dloadbox/services/dloadbox-caddy.service" 42 | file_service_telegram_bot="/opt/dloadbox/services/dloadbox-telegrambot.service" 43 | file_service_filebrowser="/opt/dloadbox/services/dloadbox-filebrowser.service" 44 | # Binaries 45 | file_bin_aria2c="/opt/dloadbox/bin/dloadbox-aria2c" 46 | file_bin_caddy="/opt/dloadbox/bin/dloadbox-caddy" 47 | file_bin_telegram_bot="/opt/dloadbox/bin/dloadbox-telegrambot" 48 | file_bin_filebrowser="/opt/dloadbox/bin/dloadbox-filebrowser" 49 | file_bin_dloadbox_manager="/opt/dloadbox/bin/dloadbox-manager.sh" 50 | file_bin_dloadbox_installer="/opt/dloadbox/bin/dloadbox-installer.sh" 51 | file_bin_dloadbox_configurator="/opt/dloadbox/bin/dloadbox-configurator.sh" 52 | #file_bin_env_python3="/opt/dloadbox/venv/dloadbox-telegrambot/bin/python3" 53 | # Symbolic links 54 | #symb_config_webserver="/etc/lighttpd/conf-enabled/dloadbox-lighttpd.conf" 55 | symb_service_ariarpc="/etc/systemd/system/dloadbox-ariarpc.service" 56 | symb_service_filebrowser="/etc/systemd/system/dloadbox-filebrowser.service" 57 | symb_service_telegram_bot="/etc/systemd/system/dloadbox-telegrambot.service" 58 | symb_service_webserver="/etc/systemd/system/dloadbox-caddy.service" 59 | symb_bin_filebrowser="/usr/bin/dloadbox-filebrowser" 60 | symb_bin_dloadbox="/bin/dloadbox" 61 | # Directories 62 | dir_dloadbox="/opt/dloadbox" 63 | dir_bin="/opt/dloadbox/bin" 64 | dir_config="/opt/dloadbox/config" 65 | dir_services="/opt/dloadbox/services" 66 | dir_log="/opt/dloadbox/log" 67 | dir_www="/opt/dloadbox/www" 68 | #dir_venv="/opt/dloadbox/venv" 69 | #dir_venv_telegrambot="/opt/dloadbox/venv/dloadbox-telegrambot/" 70 | # dloadbox hierarchy array 71 | hierarchy=( 72 | "$file_dloadbox_info" 73 | "$file_config_aria2" 74 | "$file_config_ariang" 75 | "$file_config_webserver" 76 | "$file_config_telegram_bot" 77 | "$file_config_filebrowser_json" 78 | "$file_config_dloadbox" 79 | "$file_bin_caddy" 80 | "$file_bin_filebrowser" 81 | ) 82 | #endregion 83 | #region variables 84 | # ################################################################################## # 85 | # # DloadBox Variables # # 86 | # ################################################################################## # 87 | # IP config 88 | CONFIG_IP_MAIN="" 89 | CONFIG_INTERFACE_MAIN="" 90 | # Aria2 config 91 | CONFIG_ARIA2_RPC_SECRET="" 92 | CONFIG_ARIA2_RPC_LISTEN_PORT="" 93 | # Telegram bot config 94 | CONFIG_TELEGRAMBOT_LIMIT_PERMISSION="" 95 | CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES="" 96 | CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET="" 97 | CONFIG_TELEGRAMBOT_ARIA2_RPC_URL="" 98 | CONFIG_TELEGRAMBOT_BOT_TOKEN="" 99 | CONFIG_TELEGRAMBOT_BOT_USERNAME="" 100 | # Webserver config 101 | CONFIG_WEBSERVER_PORT="" 102 | # Filebrowser config 103 | CONFIG_FILEBROWSER_PASSWORD="" 104 | CONFIG_FILEBROWSER_PASSWORD_HASH="" 105 | CONFIG_FILEBROWSER_USERNAME="" 106 | CONFIG_FILEBROWSER_PORT="" 107 | # AriaNG config 108 | CONFIG_ARIANG_URL="" 109 | CONFIG_ARIANG_RPC_SECRET_HASH="" 110 | # Caddy config 111 | CONFIG_CADDY_PASSWORD="" 112 | CONFIG_CADDY_PASSWORD_HASH="" 113 | CONFIG_CADDY_USERNAME="" 114 | # Services name variables 115 | CONFIG_SERVICE_NAME_ARIARPC="" 116 | CONFIG_SERVICE_NAME_FILEBROWSER="" 117 | CONFIG_SERVICE_NAME_TELEGRAM="" 118 | # check variables 119 | CHECK_HIERARCHY_ISOK=true 120 | #endregion 121 | 122 | #region Log 123 | # ################################################################################## # 124 | # # DloadBox Log # # 125 | # ################################################################################## # 126 | # Log file 127 | LOG_FILE="/opt/dloadbox/log/dloadbox-manager.log" 128 | # Define colors 129 | GREEN='\033[0;32m' 130 | YELLOW='\033[1;33m' 131 | # shellcheck disable=SC2034 132 | ORANGE='\033[0;33m' 133 | RED='\033[0;31m' 134 | BLUE='\033[0;34m' 135 | CYAN='\033[0;36m' 136 | NC='\033[0m' 137 | BOLD='\033[1m' 138 | # date format 139 | DATE_FORMAT='+%Y-%m-%d %H:%M:%S' 140 | #endregion 141 | } 142 | az_log() { 143 | local mode="${1:-b}" 144 | local message="$2" 145 | 146 | # Check if message is provided 147 | if [[ -z "$message" ]]; then 148 | echo "No message provided." 149 | return 150 | fi 151 | 152 | local current_date 153 | current_date=$(date "$DATE_FORMAT") 154 | 155 | case "$mode" in 156 | b) 157 | echo "$message" 158 | echo "$current_date - $message" >> "$LOG_FILE" 159 | ;; 160 | bg) 161 | echo -e "${GREEN}${BOLD}$message${NC}" 162 | echo "$current_date - $message" >> "$LOG_FILE" 163 | ;; 164 | br) 165 | echo -e "${RED}${BOLD}$message${NC}" 166 | echo "$current_date - $message" >> "$LOG_FILE" 167 | ;; 168 | l) 169 | echo "$current_date - $message" >> "$LOG_FILE" 170 | ;; 171 | s) 172 | echo "$message" 173 | ;; 174 | sg) 175 | echo -e "${GREEN}${BOLD}$message${NC}" 176 | ;; 177 | sr) 178 | echo -e "${RED}${BOLD}$message${NC}" 179 | ;; 180 | *) 181 | echo "$message" 182 | echo "$current_date - $message" >> "$LOG_FILE" 183 | ;; 184 | esac 185 | } 186 | check_hierarchy(){ 187 | local count=0 188 | local count_success=0 189 | local count_failed=0 190 | CHECK_HIERARCHY_ISOK=true 191 | az_log b "Checking DloadBox Files and Directories..." 192 | for item in "${hierarchy[@]}"; do 193 | ((count++)) 194 | if [[ ! -e "$item" ]]; then 195 | az_log br "❌ Not found: $item" 196 | ((count_failed++)) 197 | else 198 | az_log l "Found: $item" 199 | ((count_success++)) 200 | fi 201 | done 202 | if [[ "$count_failed" == "0" ]]; then 203 | az_log l "✅ ALL DloadBox Files and Directories Found" 204 | return 0 205 | else 206 | az_log br "❌ Error: $count_failed of $count DloadBox Files and Directories are missing" 207 | CHECK_HIERARCHY_ISOK=false 208 | exit 1 209 | fi 210 | } 211 | main(){ 212 | init_variables 213 | check_hierarchy 214 | } 215 | main -------------------------------------------------------------------------------- /bin/dloadbox-manager.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # DloadBox Installer 3 | # DloadBox is a complete download management platform combining aria2c, Lighttpd, ariaNG, RPC integration, and a Telegram bot. 4 | # It offers a user-friendly web interface and remote control, enabling efficient and scalable management of downloads from anywhere. 5 | #region version 6 | # Version info 7 | VERSION_DLOADBOX="alpha-2.2.9" 8 | VERSION_DLOADBOX_CREATE="2024-12-01" 9 | VERSION_DLOADBOX_UPDATE="2025-04-17" 10 | VERSION_FILEBROWSER="2.31.2" 11 | VERSION_ARIANG="1.3.8" 12 | VERSION_CADDY="2.9.1" 13 | VERSION_ARIA2C="1.37.0" 14 | #endregion 15 | init_variables(){ 16 | #region URL 17 | # ################################################################################## # 18 | # # URL # # 19 | # ################################################################################## # 20 | # DloadBox URL 21 | URL_DLOADBOX_GITHUB="https://github.com/azolfaghar/dloadbox" 22 | URL_DLOADBOX_GITHUB_ISSUES="https://github.com/azolfaghar/dloadbox/issues" 23 | URL_DLOADBOX_LATEST_ZIP="https://github.com/azolfagharj/DloadBox/releases/download/$VERSION_DLOADBOX/dloadbox.zip" 24 | URL_FILEBROWSER_TARGZ="https://github.com/filebrowser/filebrowser/releases/download/v$VERSION_FILEBROWSER/linux-amd64-filebrowser.tar.gz" 25 | URL_ARIANG_ZIP="https://github.com/mayswind/AriaNg/releases/download/$VERSION_ARIANG/AriaNg-$VERSION_ARIANG.zip" 26 | URL_CADDY_TARGZ="https://github.com/caddyserver/caddy/releases/download/v$VERSION_CADDY/caddy_${VERSION_CADDY}_linux_amd64.tar.gz" 27 | #endregion 28 | #region hierarchy 29 | # ################################################################################## # 30 | # # DloadBox Hierarchy # # 31 | # ################################################################################## # 32 | # Info file 33 | file_dloadbox_info="/opt/dloadbox/dloadbox-info" 34 | # Config files 35 | file_config_aria2="/opt/dloadbox/config/dloadbox-aria2.conf" 36 | file_config_ariang="/opt/dloadbox/config/dloadbox-ariang.conf" 37 | file_config_webserver="/opt/dloadbox/config/dloadbox-caddy.conf" 38 | file_config_telegram_bot="/opt/dloadbox/config/dloadbox-telegrambot.conf" 39 | file_config_filebrowser_json="/opt/dloadbox/config/dloadbox-filebrowser.json" 40 | file_config_filebrowser_db="/opt/dloadbox/config/dloadbox-filebrowser.db" 41 | file_config_dloadbox="/opt/dloadbox/config/dloadbox.conf" 42 | # Services files 43 | file_service_dloadbox="/opt/dloadbox/services/dloadbox.service" 44 | file_service_ariarpc="/opt/dloadbox/services/dloadbox-ariarpc.service" 45 | file_service_webserver="/opt/dloadbox/services/dloadbox-caddy.service" 46 | file_service_telegram_bot="/opt/dloadbox/services/dloadbox-telegrambot.service" 47 | file_service_filebrowser="/opt/dloadbox/services/dloadbox-filebrowser.service" 48 | # Binaries 49 | file_bin_aria2c="/opt/dloadbox/bin/dloadbox-aria2c" 50 | file_bin_caddy="/opt/dloadbox/bin/dloadbox-caddy" 51 | file_bin_telegram_bot="/opt/dloadbox/bin/dloadbox-telegrambot" 52 | file_bin_filebrowser="/opt/dloadbox/bin/dloadbox-filebrowser" 53 | file_bin_dloadbox_manager="/opt/dloadbox/bin/dloadbox-manager.sh" 54 | file_bin_dloadbox_installer="/opt/dloadbox/bin/dloadbox-installer.sh" 55 | file_bin_dloadbox_configurator="/opt/dloadbox/bin/dloadbox-configurator.sh" 56 | #file_bin_env_python3="/opt/dloadbox/venv/dloadbox-telegrambot/bin/python3" 57 | # Symbolic links 58 | #symb_config_webserver="/etc/lighttpd/conf-enabled/dloadbox-lighttpd.conf" 59 | symb_service_ariarpc="/etc/systemd/system/dloadbox-ariarpc.service" 60 | symb_service_filebrowser="/etc/systemd/system/dloadbox-filebrowser.service" 61 | symb_service_telegram_bot="/etc/systemd/system/dloadbox-telegrambot.service" 62 | symb_service_webserver="/etc/systemd/system/dloadbox-caddy.service" 63 | symb_bin_filebrowser="/usr/bin/dloadbox-filebrowser" 64 | symb_bin_dloadbox="/bin/dloadbox" 65 | # Directories 66 | dir_dloadbox="/opt/dloadbox" 67 | dir_bin="/opt/dloadbox/bin" 68 | dir_config="/opt/dloadbox/config" 69 | dir_services="/opt/dloadbox/services" 70 | dir_log="/opt/dloadbox/log" 71 | dir_www="/opt/dloadbox/www" 72 | #dir_venv="/opt/dloadbox/venv" 73 | #dir_venv_telegrambot="/opt/dloadbox/venv/dloadbox-telegrambot/" 74 | # dloadbox hierarchy array 75 | hierarchy=( 76 | "$file_dloadbox_info" 77 | "$file_config_aria2" 78 | "$file_config_ariang" 79 | "$file_config_webserver" 80 | "$file_config_telegram_bot" 81 | "$file_config_filebrowser_json" 82 | "$file_config_filebrowser_db" 83 | "$file_config_dloadbox" 84 | "$file_service_ariarpc" 85 | "$file_service_webserver" 86 | "$file_service_telegram_bot" 87 | "$file_service_filebrowser" 88 | "$file_service_dloadbox" 89 | "$file_bin_aria2c" 90 | "$file_bin_caddy" 91 | "$file_bin_telegram_bot" 92 | "$file_bin_filebrowser" 93 | "$file_bin_dloadbox_manager" 94 | "$file_bin_dloadbox_installer" 95 | "$file_bin_dloadbox_configurator" 96 | #"$file_bin_env_python3" 97 | #"$symb_config_webserver" 98 | "$symb_service_ariarpc" 99 | "$symb_service_filebrowser" 100 | "$symb_service_telegram_bot" 101 | "$symb_service_webserver" 102 | "$symb_bin_filebrowser" 103 | "$symb_bin_dloadbox" 104 | "$dir_dloadbox" 105 | "$dir_bin" 106 | "$dir_config" 107 | "$dir_services" 108 | "$dir_log" 109 | "$dir_www" 110 | #"$dir_venv" 111 | #"$dir_venv_telegrambot" 112 | ) 113 | #endregion 114 | #region variables 115 | # ################################################################################## # 116 | # # DloadBox Variables # # 117 | # ################################################################################## # 118 | # IP config 119 | CONFIG_IP_MAIN="" 120 | CONFIG_INTERFACE_MAIN="" 121 | # Aria2 config 122 | CONFIG_ARIA2_RPC_SECRET="" 123 | CONFIG_ARIA2_RPC_LISTEN_PORT="" 124 | # Telegram bot config 125 | CONFIG_TELEGRAMBOT_LIMIT_PERMISSION="" 126 | CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES="" 127 | CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET="" 128 | CONFIG_TELEGRAMBOT_ARIA2_RPC_URL="" 129 | CONFIG_TELEGRAMBOT_BOT_TOKEN="" 130 | CONFIG_TELEGRAMBOT_BOT_USERNAME="" 131 | # Webserver config 132 | CONFIG_WEBSERVER_PORT="" 133 | # Filebrowser config 134 | CONFIG_FILEBROWSER_PASSWORD="" 135 | CONFIG_FILEBROWSER_PASSWORD_HASH="" 136 | CONFIG_FILEBROWSER_USERNAME="" 137 | CONFIG_FILEBROWSER_PORT="" 138 | # AriaNG config 139 | CONFIG_ARIANG_URL="" 140 | CONFIG_ARIANG_RPC_SECRET_HASH="" 141 | # Caddy config 142 | CONFIG_CADDY_PASSWORD="" 143 | CONFIG_CADDY_PASSWORD_HASH="" 144 | CONFIG_CADDY_USERNAME="" 145 | # Services name variables 146 | CONFIG_SERVICE_NAME_ARIARPC="" 147 | CONFIG_SERVICE_NAME_FILEBROWSER="" 148 | CONFIG_SERVICE_NAME_TELEGRAM="" 149 | # check variables 150 | CHECK_HIERARCHY_ISOK=true 151 | CHECK_INFOCONFIG_ISOK=true 152 | #endregion 153 | 154 | #region Log 155 | # ################################################################################## # 156 | # # DloadBox Log # # 157 | # ################################################################################## # 158 | # Log file 159 | LOG_FILE="/opt/dloadbox/log/dloadbox-manager.log" 160 | # Define colors 161 | GREEN='\033[0;32m' 162 | YELLOW='\033[1;33m' 163 | # shellcheck disable=SC2034 164 | ORANGE='\033[0;33m' 165 | RED='\033[0;31m' 166 | BLUE='\033[0;34m' 167 | CYAN='\033[0;36m' 168 | NC='\033[0m' 169 | BOLD='\033[1m' 170 | # date format 171 | DATE_FORMAT='+%Y-%m-%d %H:%M:%S' 172 | #endregion 173 | } 174 | display_logo() { 175 | echo "" 176 | echo -e " ${BLUE}██████╗ ${GREEN}██╗ ██████╗ █████╗ ██████╗ ${CYAN}██████╗ ██████╗ ██╗ ██╗${NC}" 177 | echo -e " ${BLUE}██╔══██╗${GREEN}██║ ██╔═══██╗██╔══██╗██╔══██╗${CYAN}██╔══██╗██╔═══██╗╚██╗██╔╝${NC}" 178 | echo -e " ${BLUE}██║ ██║${GREEN}██║ ██║ ██║███████║██║ ██║${CYAN}██████╔╝██║ ██║ ╚███╔╝${NC}" 179 | echo -e " ${BLUE}██║ ██║${GREEN}██║ ██║ ██║██╔══██║██║ ██║${CYAN}██╔══██╗██║ ██║ ██╔██╗${NC}" 180 | echo -e " ${BLUE}██████╔╝${GREEN}███████╗╚██████╔╝██║ ██║██████╔╝${CYAN}██████╔╝╚██████╔╝██╔╝ ██╗${NC}" 181 | echo -e " ${BLUE}╚═════╝ ${GREEN}╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ${CYAN}╚═════╝ ╚═════╝ ╚═╝ ╚═╝${NC}" 182 | echo -e " ${YELLOW}Download Management Platform${NC}" 183 | echo -e " ${CYAN}by ${YELLOW}${BOLD}A.ZOLFAGHAR${NC}" 184 | echo "" 185 | echo -e "${RED}╭─────────────╮${NC}" 186 | echo -e "${RED}│ Manager │${NC}" 187 | echo -e "${RED}╰─────────────╯${NC}" 188 | echo "" 189 | } 190 | setup_static_header() { 191 | clear 192 | echo -e "\033[H" 193 | display_logo 194 | echo -e "\033[15;r" 195 | echo -e "\033[15;1H" 196 | } 197 | az_log() { 198 | local mode="${1:-b}" 199 | local message="$2" 200 | 201 | # Check if message is provided 202 | if [[ -z "$message" ]]; then 203 | echo "No message provided." 204 | return 205 | fi 206 | 207 | local current_date 208 | current_date=$(date "$DATE_FORMAT") 209 | 210 | case "$mode" in 211 | b) 212 | echo "$message" 213 | echo "$current_date - $message" >> "$LOG_FILE" 214 | ;; 215 | bg) 216 | echo -e "${GREEN}${BOLD}$message${NC}" 217 | echo "$current_date - $message" >> "$LOG_FILE" 218 | ;; 219 | br) 220 | echo -e "${RED}${BOLD}$message${NC}" 221 | echo "$current_date - $message" >> "$LOG_FILE" 222 | ;; 223 | l) 224 | echo "$current_date - $message" >> "$LOG_FILE" 225 | ;; 226 | s) 227 | echo "$message" 228 | ;; 229 | sg) 230 | echo -e "${GREEN}${BOLD}$message${NC}" 231 | ;; 232 | sr) 233 | echo -e "${RED}${BOLD}$message${NC}" 234 | ;; 235 | *) 236 | echo "$message" 237 | echo "$current_date - $message" >> "$LOG_FILE" 238 | ;; 239 | esac 240 | } 241 | service_manager() { 242 | local action="" 243 | local services=() 244 | local exit_code=0 245 | local quiet=false 246 | 247 | # Initial daemon-reload 248 | az_log b "🔄 Reloading systemd daemon..." 249 | if systemctl daemon-reload &>/dev/null; then 250 | az_log bg "✅ Systemd daemon reloaded successfully" 251 | else 252 | az_log br "❌ Failed to reload systemd daemon" 253 | return 1 254 | fi 255 | az_log b "---------------------------------" 256 | 257 | # Parse arguments 258 | while [[ $# -gt 0 ]]; do 259 | case "$1" in 260 | --start|--stop|--restart|--enable|--disable|--remove) 261 | action="$1" 262 | shift 263 | ;; 264 | -q|--quiet) 265 | quiet=true 266 | shift 267 | ;; 268 | *) 269 | services+=("$1") 270 | shift 271 | ;; 272 | esac 273 | done 274 | 275 | # Validate inputs 276 | if [ -z "$action" ]; then 277 | [[ $quiet == false ]] && az_log br "❌ No action specified! Use --start, --stop, --restart, --enable, --disable, or --remove" 278 | return 1 279 | fi 280 | 281 | if [ ${#services[@]} -eq 0 ]; then 282 | [[ $quiet == false ]] && az_log br "❌ No services specified!" 283 | return 1 284 | fi 285 | 286 | # Process each service 287 | for service in "${services[@]}"; do 288 | case "$action" in 289 | --start) 290 | [[ $quiet == false ]] && az_log b "🔄 Checking service: $service" 291 | if systemctl list-unit-files | grep -q "$service"; then 292 | if systemctl is-active --quiet "$service"; then 293 | [[ $quiet == false ]] && az_log bg "✅ Service $service is already running" 294 | else 295 | [[ $quiet == false ]] && az_log b "🔄 Starting service: $service" 296 | if systemctl start "$service" &>/dev/null; then 297 | sleep 1 298 | if systemctl is-active --quiet "$service"; then 299 | [[ $quiet == false ]] && az_log bg "✅ Service $service started successfully" 300 | else 301 | [[ $quiet == false ]] && az_log br "❌ Service $service failed to start (not active after start)" 302 | exit_code=1 303 | fi 304 | else 305 | [[ $quiet == false ]] && az_log br "❌ Failed to start service: $service" 306 | exit_code=1 307 | fi 308 | fi 309 | else 310 | [[ $quiet == false ]] && az_log br "❌ Service $service does not exist" 311 | exit_code=1 312 | fi 313 | ;; 314 | 315 | --stop) 316 | [[ $quiet == false ]] && az_log b "🔄 Checking service: $service" 317 | if systemctl list-unit-files | grep -q "$service"; then 318 | if ! systemctl is-active --quiet "$service"; then 319 | [[ $quiet == false ]] && az_log bg "✅ Service $service is already stopped" 320 | else 321 | [[ $quiet == false ]] && az_log b "🔄 Stopping service: $service" 322 | if systemctl stop "$service" &>/dev/null; then 323 | sleep 1 324 | if ! systemctl is-active --quiet "$service"; then 325 | [[ $quiet == false ]] && az_log bg "✅ Service $service stopped successfully" 326 | else 327 | [[ $quiet == false ]] && az_log br "❌ Service $service failed to stop (still active after stop)" 328 | exit_code=1 329 | fi 330 | else 331 | [[ $quiet == false ]] && az_log br "❌ Failed to stop service: $service" 332 | exit_code=1 333 | fi 334 | fi 335 | else 336 | [[ $quiet == false ]] && az_log br "❌ Service $service does not exist" 337 | exit_code=1 338 | fi 339 | ;; 340 | 341 | --restart) 342 | [[ $quiet == false ]] && az_log b "🔄 Checking service: $service" 343 | if systemctl list-unit-files | grep -q "$service"; then 344 | [[ $quiet == false ]] && az_log b "🔄 Restarting service: $service" 345 | if systemctl restart "$service" &>/dev/null; then 346 | sleep 1 347 | if systemctl is-active --quiet "$service"; then 348 | [[ $quiet == false ]] && az_log bg "✅ Service $service restarted successfully" 349 | else 350 | [[ $quiet == false ]] && az_log br "❌ Service $service failed to restart (not active after restart)" 351 | exit_code=1 352 | fi 353 | else 354 | [[ $quiet == false ]] && az_log br "❌ Failed to restart service: $service" 355 | exit_code=1 356 | fi 357 | else 358 | [[ $quiet == false ]] && az_log br "❌ Service $service does not exist" 359 | exit_code=1 360 | fi 361 | ;; 362 | 363 | --enable) 364 | [[ $quiet == false ]] && az_log b "🔄 Checking service: $service" 365 | if systemctl list-unit-files | grep -q "$service"; then 366 | if systemctl is-enabled --quiet "$service"; then 367 | [[ $quiet == false ]] && az_log bg "✅ Service $service is already enabled" 368 | else 369 | [[ $quiet == false ]] && az_log b "🔄 Enabling service: $service" 370 | if systemctl enable "$service" &>/dev/null; then 371 | if systemctl is-enabled --quiet "$service"; then 372 | [[ $quiet == false ]] && az_log bg "✅ Service $service enabled successfully" 373 | else 374 | [[ $quiet == false ]] && az_log br "❌ Service $service failed to enable (not enabled after enable command)" 375 | exit_code=1 376 | fi 377 | else 378 | [[ $quiet == false ]] && az_log br "❌ Failed to enable service: $service" 379 | exit_code=1 380 | fi 381 | fi 382 | else 383 | [[ $quiet == false ]] && az_log br "❌ Service $service does not exist" 384 | exit_code=1 385 | fi 386 | ;; 387 | 388 | --disable) 389 | [[ $quiet == false ]] && az_log b "🔄 Checking service: $service" 390 | if systemctl list-unit-files | grep -q "$service"; then 391 | if ! systemctl is-enabled --quiet "$service"; then 392 | [[ $quiet == false ]] && az_log bg "✅ Service $service is already disabled" 393 | else 394 | [[ $quiet == false ]] && az_log b "🔄 Disabling service: $service" 395 | if systemctl disable "$service" &>/dev/null; then 396 | if ! systemctl is-enabled --quiet "$service"; then 397 | [[ $quiet == false ]] && az_log bg "✅ Service $service disabled successfully" 398 | else 399 | [[ $quiet == false ]] && az_log br "❌ Service $service failed to disable (still enabled after disable command)" 400 | exit_code=1 401 | fi 402 | else 403 | [[ $quiet == false ]] && az_log br "❌ Failed to disable service: $service" 404 | exit_code=1 405 | fi 406 | fi 407 | else 408 | [[ $quiet == false ]] && az_log br "❌ Service $service does not exist" 409 | exit_code=1 410 | fi 411 | ;; 412 | 413 | --remove) 414 | [[ $quiet == false ]] && az_log b "🔄 Checking service: $service" 415 | if systemctl list-unit-files | grep -q "$service"; then 416 | if systemctl is-active --quiet "$service"; then 417 | [[ $quiet == false ]] && az_log b "🔄 Stopping service: $service" 418 | if ! systemctl stop "$service" &>/dev/null; then 419 | [[ $quiet == false ]] && az_log br "❌ Failed to stop service: $service" 420 | exit_code=1 421 | continue 422 | fi 423 | sleep 1 424 | if systemctl is-active --quiet "$service"; then 425 | [[ $quiet == false ]] && az_log br "❌ Service $service failed to stop (still active)" 426 | exit_code=1 427 | continue 428 | fi 429 | fi 430 | 431 | if systemctl is-enabled --quiet "$service"; then 432 | [[ $quiet == false ]] && az_log b "🔄 Disabling service: $service" 433 | if ! systemctl disable "$service" &>/dev/null; then 434 | [[ $quiet == false ]] && az_log br "❌ Failed to disable service: $service" 435 | exit_code=1 436 | continue 437 | fi 438 | fi 439 | 440 | # First check if service file exists in /etc/systemd/system/ 441 | if [ -f "/etc/systemd/system/${service}.service" ]; then 442 | local service_path 443 | service_path=$(systemctl show -p FragmentPath "$service" | cut -d'=' -f2) 444 | if [ -f "$service_path" ]; then 445 | [[ $quiet == false ]] && az_log b "🔄 Removing service file: $service" 446 | if rm "$service_path" &>/dev/null; then 447 | systemctl daemon-reload &>/dev/null 448 | [[ $quiet == false ]] && az_log bg "✅ Service $service removed successfully" 449 | else 450 | [[ $quiet == false ]] && az_log br "❌ Failed to remove service file: $service" 451 | exit_code=1 452 | fi 453 | else 454 | [[ $quiet == false ]] && az_log br "❌ Service file not found: $service" 455 | exit_code=1 456 | fi 457 | fi 458 | else 459 | [[ $quiet == false ]] && az_log br "❌ Service $service does not exist" 460 | exit_code=1 461 | fi 462 | ;; 463 | esac 464 | done 465 | 466 | # Final daemon-reload 467 | [[ $quiet == false ]] && az_log b "---------------------------------" 468 | [[ $quiet == false ]] && az_log b "🔄 Reloading systemd daemon..." 469 | if systemctl daemon-reload &>/dev/null; then 470 | [[ $quiet == false ]] && az_log bg "✅ Systemd daemon reloaded successfully" 471 | else 472 | [[ $quiet == false ]] && az_log br "❌ Failed to reload systemd daemon" 473 | exit_code=1 474 | fi 475 | 476 | return $exit_code 477 | } 478 | check_hierarchy(){ 479 | local count=0 480 | local count_success=0 481 | local count_failed=0 482 | CHECK_HIERARCHY_ISOK=true 483 | az_log b "Checking DloadBox Files and Directories..." 484 | for item in "${hierarchy[@]}"; do 485 | ((count++)) 486 | if [[ ! -e "$item" ]]; then 487 | az_log br "❌ Not found: $item" 488 | ((count_failed++)) 489 | else 490 | az_log l "Found: $item" 491 | ((count_success++)) 492 | fi 493 | done 494 | if [[ "$count_failed" == "0" ]]; then 495 | az_log bg "✅ ALL DloadBox Files and Directories Found" 496 | return 0 497 | else 498 | az_log br "❌ Error: $count_failed of $count DloadBox Files and Directories are missing" 499 | CHECK_HIERARCHY_ISOK=false 500 | return 1 501 | fi 502 | } 503 | config_detector_info(){ 504 | az_log b "Detecting dloadbox-info Config..." 505 | CHECK_INFOCONFIG_ISOK=true 506 | local count=0 507 | local count_success=0 508 | local count_failed=0 509 | if [ -f "$file_dloadbox_info" ]; then 510 | # Create arrays for the keys and corresponding variable names 511 | local config_keys=("INTERNALCONFIG_IP_MAIN" "INTERNALCONFIG_INTERFACE_MAIN" "INTERNALCONFIG_ARIA2_RPC_SECRET" "INTERNALCONFIG_ARIA2_RPC_LISTEN_PORT" "INTERNALCONFIG_TELEGRAMBOT_LIMIT_PERMISSION" "INTERNALCONFIG_TELEGRAMBOT_ALLOWED_USERNAMES" "INTERNALCONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET" "INTERNALCONFIG_TELEGRAMBOT_ARIA2_RPC_URL" "INTERNALCONFIG_TELEGRAMBOT_BOT_TOKEN" "INTERNALCONFIG_TELEGRAMBOT_BOT_USERNAME" "INTERNALCONFIG_WEBSERVER_PORT" "INTERNALCONFIG_FILEBROWSER_PASSWORD_HASH" "INTERNALCONFIG_FILEBROWSER_USERNAME" "INTERNALCONFIG_FILEBROWSER_PORT" "INTERNALCONFIG_ARIANG_RPC_SECRET_HASH" "INTERNALCONFIG_ARIANG_URL") 512 | local config_vars=("INTERNALCONFIG_IP_MAIN" "INTERNALCONFIG_INTERFACE_MAIN" "INTERNALCONFIG_ARIA2_RPC_SECRET" "INTERNALCONFIG_ARIA2_RPC_LISTEN_PORT" "INTERNALCONFIG_TELEGRAMBOT_LIMIT_PERMISSION" "INTERNALCONFIG_TELEGRAMBOT_ALLOWED_USERNAMES" "INTERNALCONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET" "INTERNALCONFIG_TELEGRAMBOT_ARIA2_RPC_URL" "INTERNALCONFIG_TELEGRAMBOT_BOT_TOKEN" "INTERNALCONFIG_TELEGRAMBOT_BOT_USERNAME" "INTERNALCONFIG_WEBSERVER_PORT" "INTERNALCONFIG_FILEBROWSER_PASSWORD_HASH" "INTERNALCONFIG_FILEBROWSER_USERNAME" "INTERNALCONFIG_FILEBROWSER_PORT" "INTERNALCONFIG_ARIANG_RPC_SECRET_HASH" "INTERNALCONFIG_ARIANG_URL") 513 | 514 | # Clear all variables before starting 515 | az_log b "Clearing all previous values before starting..." 516 | for var in "${config_vars[@]}"; do 517 | eval "$var=''" 518 | done 519 | 520 | # Loop through the keys and extract values 521 | for i in "${!config_keys[@]}"; do 522 | ((count++)) 523 | key="${config_keys[$i]}" 524 | var="${config_vars[$i]}" 525 | value=$(grep -iw "$key" "$file_dloadbox_info" | awk -F'=' '{print $2}' 2>/dev/null) 526 | if [ -z "$value" ]; then 527 | az_log br "Error: Unable to retrieve $key from dloadbox-info file." 528 | ((count_failed++)) 529 | else 530 | eval "$var=\"$value\"" 531 | az_log l "SUCCESS: $key extracted successfully: $value" 532 | ((count_success++)) 533 | fi 534 | done 535 | else 536 | az_log br "Error: Can't Detect DloadBox Configs: File: $file_dloadbox_info not found." 537 | CHECK_INFOCONFIG_ISOK=false 538 | fi 539 | if [[ "$count_failed" == "0" ]]; then 540 | az_log bg "All $count DloadBox Configs successfully detected from dloadbox-info file." 541 | CHECK_INFOCONFIG_ISOK=true 542 | return 0 543 | else 544 | az_log br "Error: $count_failed Item out of $count DloadBox configurations could not be Extracted." 545 | CHECK_INFOCONFIG_ISOK=false 546 | return 1 547 | fi 548 | } 549 | config_detector(){ 550 | CHECK_CONFIG_ISOK=true 551 | az_log b "Detecting all DloadBox Configurations" 552 | check_hierarchy 553 | if [[ "$CHECK_HIERARCHY_ISOK" == "false" ]]; then 554 | az_log br "Error: Some DloadBox Files and Directories are missing, can't detect all DloadBox Configs" 555 | CHECK_CONFIG_ISOK=false 556 | return 1 557 | fi 558 | local config_vars=("CONFIG_IP_MAIN" "CONFIG_INTERFACE_MAIN" "CONFIG_ARIA2_RPC_SECRET" "CONFIG_ARIA2_RPC_LISTEN_PORT" "CONFIG_TELEGRAMBOT_LIMIT_PERMISSION" "CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES" "CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET" "CONFIG_TELEGRAMBOT_ARIA2_RPC_URL" "CONFIG_TELEGRAMBOT_BOT_TOKEN" "CONFIG_TELEGRAMBOT_BOT_USERNAME" "CONFIG_WEBSERVER_PORT" "CONFIG_FILEBROWSER_PASSWORD_HASH" "CONFIG_FILEBROWSER_USERNAME" "CONFIG_FILEBROWSER_PORT" "CONFIG_ARIANG_RPC_SECRET_HASH" "CONFIG_ARIANG_URL") 559 | local total_configs=${#config_vars[@]} 560 | local total_failed=0 561 | local total_success=0 562 | az_log b "Total number of configurations: $total_configs" 563 | az_log b "Clearing all previous values before starting..." 564 | for var in "${config_vars[@]}"; do 565 | eval "$var=''" 566 | done 567 | az_log l "Detecting Main Network Interface and IP Address..." 568 | CONFIG_INTERFACE_MAIN=$(ip route | awk '/default/ {print $5}' | head -n 1) 569 | CONFIG_IP_MAIN=$(ip addr show "$CONFIG_INTERFACE_MAIN" | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1) 570 | # Aria2 config 571 | az_log l "Detecting ARIA2 RPC Configuration..." 572 | CONFIG_ARIA2_RPC_SECRET=$(grep -i rpc-secret "$file_config_aria2" | awk -F'=' '{print $2}') 573 | CONFIG_ARIA2_RPC_SECRET_HASH=$(echo -n "$CONFIG_ARIA2_RPC_SECRET" | base64 | tr '+/' '-_' | sed 's/=//g') 574 | CONFIG_ARIA2_RPC_LISTEN_PORT=$(grep -i rpc-listen-port "$file_config_aria2" | awk -F'=' '{print $2}') 575 | # Telegram bot config 576 | az_log l "Detecting telegram bot config..." 577 | CONFIG_TELEGRAMBOT_BOT_TOKEN=$(grep -i BOT_TOKEN "$file_config_telegram_bot" | awk -F'=' '{print $2}') 578 | CONFIG_TELEGRAMBOT_LIMIT_PERMISSION=$(grep -i LIMIT_PERMISSION "$file_config_telegram_bot" | awk -F'=' '{print $2}') 579 | CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES=$(grep -i ALLOWED_USERNAMES "$file_config_telegram_bot" | awk -F'=' '{print $2}') 580 | CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET="token:${CONFIG_ARIA2_RPC_SECRET}" 581 | CONFIG_TELEGRAMBOT_ARIA2_RPC_URL="http://${CONFIG_IP_MAIN}:${CONFIG_ARIA2_RPC_LISTEN_PORT}/jsonrpc" 582 | CONFIG_TELEGRAMBOT_BOT_USERNAME=$(curl -s "https://api.telegram.org/bot$CONFIG_TELEGRAMBOT_BOT_TOKEN/getMe" | grep -o '"username":"[^"]*"' | sed -E 's/"username":"(.*)"/\1/') 583 | # Webserver config 584 | az_log l "Detecting Webserver Configuration..." 585 | CONFIG_WEBSERVER_PORT=$(grep -i : "$file_config_webserver" | awk -F'[: ]' '{print $2}') 586 | # Filebrowser config 587 | az_log l "Detecting Filebrowser Configuration..." 588 | CONFIG_FILEBROWSER_PASSWORD_HASH=$(grep -i password "$file_config_filebrowser_json" | awk -F'"' '{print $4}') 589 | CONFIG_FILEBROWSER_USERNAME=$(grep -i username "$file_config_filebrowser_json" | awk -F'"' '{print $4}') 590 | CONFIG_FILEBROWSER_PORT=$(grep -Eo '"port": [0-9]+' "$file_config_filebrowser_json" | awk '{print $2}') 591 | # ariang config 592 | az_log l "Detecting Ariang Configuration..." 593 | CONFIG_ARIANG_RPC_SECRET_HASH=$(echo -n "$CONFIG_ARIA2_RPC_SECRET" | base64 | tr '+/' '-_' | sed 's/=//g') 594 | CONFIG_ARIANG_URL="http://${CONFIG_IP_MAIN}:${CONFIG_WEBSERVER_PORT}/#!/settings/rpc/set/http/${CONFIG_IP_MAIN}/${CONFIG_ARIA2_RPC_LISTEN_PORT}/jsonrpc/${CONFIG_ARIANG_RPC_SECRET_HASH}" 595 | # check if all configs are set 596 | for var in "${config_vars[@]}"; do 597 | value="${!var}" 598 | if [[ -n $value ]]; then 599 | az_log l "SUCCESS: $var is set to $value" 600 | ((total_success++)) 601 | else 602 | az_log br "ERROR: $var is not set" 603 | ((total_failed++)) 604 | CHECK_CONFIG_ISOK=false 605 | fi 606 | done 607 | if $CHECK_CONFIG_ISOK; then 608 | az_log bg "All DloadBox $total_configs Configurations Successfully Detected" 609 | return 0 610 | else 611 | az_log br "Error: $total_failed Config out of $total_configs DloadBox Configurations Not Detected" 612 | return 1 613 | fi 614 | } 615 | config_changer(){ 616 | az_log b "Changing DloadBox Configurations" 617 | CHANGE_CONFIG_ISOK=true 618 | check_hierarchy 619 | if [[ "$CHECK_HIERARCHY_ISOK" == "false" ]]; then 620 | az_log br "Error: Some DloadBox Files and Directories are missing, can't change all DloadBox Configs" 621 | CHECK_CONFIG_ISOK=false 622 | return 1 623 | fi 624 | local config_vars=("CONFIG_IP_MAIN" "CONFIG_INTERFACE_MAIN" "CONFIG_ARIA2_RPC_SECRET" "CONFIG_ARIA2_RPC_LISTEN_PORT" "CONFIG_TELEGRAMBOT_LIMIT_PERMISSION" "CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES" "CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET" "CONFIG_TELEGRAMBOT_ARIA2_RPC_URL" "CONFIG_TELEGRAMBOT_BOT_TOKEN" "CONFIG_TELEGRAMBOT_BOT_USERNAME" "CONFIG_WEBSERVER_PORT" "CONFIG_FILEBROWSER_PASSWORD_HASH" "CONFIG_FILEBROWSER_USERNAME" "CONFIG_FILEBROWSER_PORT" "CONFIG_ARIANG_RPC_SECRET_HASH" "CONFIG_ARIANG_URL") 625 | az_log b "Creating some dynamic values..." 626 | CONFIG_INTERFACE_MAIN=$(ip route | awk '/default/ {print $5}' | head -n 1) 627 | CONFIG_IP_MAIN=$(ip addr show "$CONFIG_INTERFACE_MAIN" | awk '/inet / {print $2}' | cut -d/ -f1 | head -n 1) 628 | # TELEGRAMBOT BOT USERNAME 629 | CONFIG_TELEGRAMBOT_BOT_USERNAME=$(curl -s "https://api.telegram.org/bot$CONFIG_TELEGRAMBOT_BOT_TOKEN/getMe" | grep -o '"username":"[^"]*"' | sed -E 's/"username":"(.*)"/\1/') 630 | CONFIG_TELEGRAMBOT_ARIA2_RPC_URL="http://${CONFIG_IP_MAIN}:${CONFIG_ARIA2_RPC_LISTEN_PORT}/jsonrpc" 631 | CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET="token:${CONFIG_ARIA2_RPC_SECRET}" 632 | CONFIG_ARIANG_RPC_SECRET_HASH=$(echo -n "$CONFIG_ARIA2_RPC_SECRET" | base64 | tr '+/' '-_' | sed 's/=//g') 633 | CONFIG_ARIANG_URL="http://${CONFIG_IP_MAIN}:${CONFIG_WEBSERVER_PORT}/#!/settings/rpc/set/http/${CONFIG_IP_MAIN}/${CONFIG_ARIA2_RPC_LISTEN_PORT}/jsonrpc/${CONFIG_ARIANG_RPC_SECRET_HASH}" 634 | az_log bg "Done" 635 | # Check if all config variables are set 636 | az_log b "Checking if all config variables are set..." 637 | for var in "${config_vars[@]}"; do 638 | value="${!var}" 639 | if [[ -n $value ]]; then 640 | az_log l "SUCCESS: $var is set to $value" 641 | else 642 | az_log br "ERROR: $var is not set" 643 | az_log br "So DloadBox Config Changer Can't Change Configurations" 644 | CHANGE_CONFIG_ISOK=false 645 | return 1 646 | fi 647 | done 648 | az_log bg "SUCCESS: All config variables are set, Going to the next steps..." 649 | # ARIA2 RPC Listen Port 650 | if sed -i "/rpc-listen-port/c\\rpc-listen-port=${CONFIG_ARIA2_RPC_LISTEN_PORT}" "$file_config_aria2"; then 651 | az_log l "ARIA2 RPC Listen Port changed to ${CONFIG_ARIA2_RPC_LISTEN_PORT}" 652 | else 653 | az_log br "Error: Failed to change ARIA2 RPC Listen Port" 654 | CHANGE_CONFIG_ISOK=false 655 | fi 656 | # ARIA2 RPC Secret 657 | if sed -i "/rpc-secret/c\\rpc-secret=${CONFIG_ARIA2_RPC_SECRET}" "$file_config_aria2"; then 658 | az_log l "ARIA2 RPC Secret changed to ${CONFIG_ARIA2_RPC_SECRET}" 659 | else 660 | az_log br "Error: Failed to change ARIA2 RPC Secret" 661 | CHANGE_CONFIG_ISOK=false 662 | fi 663 | # TELEGRAMBOT LIMIT PERMISSION 664 | if [[ "$CONFIG_TELEGRAMBOT_LIMIT_PERMISSION" == "true" ]]; then 665 | sed -i '/LIMIT_PERMISSION/c\LIMIT_PERMISSION=true' "$file_config_telegram_bot" &>/dev/null 666 | sed -i "s|^ALLOWED_USERNAMES=.*|ALLOWED_USERNAMES=${CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES}|" "$file_config_telegram_bot" &>/dev/null 667 | az_log l "Telegram Bot Limit Permission set to true" 668 | az_log l "Allowed Usernames: ${CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES}" 669 | elif [[ "$CONFIG_TELEGRAMBOT_LIMIT_PERMISSION" == "false" ]]; then 670 | sed -i '/LIMIT_PERMISSION/c\LIMIT_PERMISSION=false' "$file_config_telegram_bot" &>/dev/nulll 671 | sed -i "s|^ALLOWED_USERNAMES=.*|ALLOWED_USERNAMES=ALL|" "$file_config_telegram_bot" &>/dev/null 672 | else 673 | az_log br "Error: Failed to set Telegram Bot Limit Permission" 674 | CHANGE_CONFIG_ISOK=false 675 | fi 676 | # TELEGRAMBOT BOT TOKEN 677 | if sed -i "s|^BOT_TOKEN=.*|BOT_TOKEN=${CONFIG_TELEGRAMBOT_BOT_TOKEN}|" "$file_config_telegram_bot" &>/dev/null; then 678 | az_log l "Telegram Bot Token set successfully" 679 | else 680 | az_log br "Error: Failed to set Telegram Bot Token" 681 | CHANGE_CONFIG_ISOK=false 682 | fi 683 | # TELEGRAMBOT ARIA2 RPC SECRET 684 | if sed -i "s|^ARIA2_RPC_SECRET=.*|ARIA2_RPC_SECRET=${CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET}|" "$file_config_telegram_bot" &>/dev/null; then 685 | az_log l "Telegram Bot ARIA2 RPC Secret set successfully" 686 | else 687 | az_log br "Error: Failed to set Telegram Bot ARIA2 RPC Secret" 688 | CHANGE_CONFIG_ISOK=false 689 | fi 690 | # TELEGRAMBOT ARIA2 RPC URL 691 | if sed -i "s|^ARIA2_RPC_URL=.*|ARIA2_RPC_URL=${CONFIG_TELEGRAMBOT_ARIA2_RPC_URL}|" "$file_config_telegram_bot" &>/dev/null; then 692 | az_log l "Telegram Bot ARIA2 RPC URL set successfully" 693 | else 694 | az_log br "Error: Failed to set Telegram Bot ARIA2 RPC URL" 695 | CHANGE_CONFIG_ISOK=false 696 | fi 697 | # WEBSERVER PORT 698 | if sed -i "s/: *[0-9]\+/:$CONFIG_WEBSERVER_PORT/" "$file_config_webserver"; then 699 | az_log l "Webserver Port changed to ${CONFIG_WEBSERVER_PORT}" 700 | else 701 | az_log br "Error: Failed to change Webserver Port" 702 | CHANGE_CONFIG_ISOK=false 703 | fi 704 | # FILEBROWSER PORT 705 | if sed -i -E "s/\"port\": [0-9]+/\"port\": $CONFIG_FILEBROWSER_PORT/" "$file_config_filebrowser_json"; then 706 | az_log l "Filebrowser Port changed to ${CONFIG_FILEBROWSER_PORT}" 707 | else 708 | az_log br "Error: Failed to change Filebrowser Port" 709 | CHANGE_CONFIG_ISOK=false 710 | fi 711 | # FILEBROWSER PASSWORD 712 | if sed -i "/\"password\"/c\ \"password\": \"$CONFIG_FILEBROWSER_PASSWORD_HASH\"" "$file_config_filebrowser_json" &>/dev/null; then 713 | az_log l "Filebrowser Password hash set successfully" 714 | else 715 | az_log br "Error: Failed to set Filebrowser Password hash" 716 | CHANGE_CONFIG_ISOK=false 717 | fi 718 | # FILEBROWSER USERNAME 719 | if sed -i "/\"username\"/c\ \"username\": \"$CONFIG_FILEBROWSER_USERNAME\"" "$file_config_filebrowser_json" &>/dev/null; then 720 | az_log l "Filebrowser Username set successfully" 721 | else 722 | az_log br "Error: Failed to set Filebrowser Username" 723 | CHANGE_CONFIG_ISOK=false 724 | fi 725 | if [[ "$CHANGE_CONFIG_ISOK" == "true" ]]; then 726 | az_log bg "All DloadBox Configurations Successfully Changed" 727 | return 0 728 | else 729 | az_log br "Error: Some DloadBox Configurations Failed to Change" 730 | return 1 731 | fi 732 | 733 | 734 | } 735 | config_changer_info(){ 736 | az_log b "Changing dloadbox-info file..." 737 | if [[ -z "$CONFIG_FILEBROWSER_PASSWORD" ]]; then 738 | CONFIG_FILEBROWSER_PASSWORD="This Password only shows after first installation" 739 | fi 740 | true > "$file_dloadbox_info" 741 | { 742 | echo "############################################################" 743 | echo "# #" 744 | echo "# !!! DO NOT EDIT THIS FILE MANUALLY !!! #" 745 | echo "# #" 746 | echo "############################################################" 747 | echo "# This file is automatically generated and managed by DloadBOX." 748 | echo "# Manual changes to this file will have no effect " 749 | echo "# On DloadBOX settings and may cause errors." 750 | echo "# To modify DloadBOX settings:" 751 | echo "# Run the 'dloadbox' command in your terminal and follow the setup process." 752 | echo "############################################################" 753 | echo 754 | echo "############################################################" 755 | echo "## DloadBox Infor for Users ##" 756 | echo "############################################################" 757 | echo 758 | echo "Download Manager" 759 | echo "----------------------------------------" 760 | echo "WEB_GUI_URL=$CONFIG_ARIANG_URL" 761 | echo "WEB_GUI_PORT=$CONFIG_WEBSERVER_PORT" 762 | echo 763 | echo "File Browser" 764 | echo "----------------------------------------" 765 | echo "FILE_BROWSER_URL=http://${CONFIG_IP_MAIN}:${CONFIG_FILEBROWSER_PORT}" 766 | echo "FILE_BROWSER_USERNAME=$CONFIG_FILEBROWSER_USERNAME" 767 | echo "FILE_BROWSER_PASSWORD=$CONFIG_FILEBROWSER_PASSWORD" 768 | echo 769 | echo "Telegram Bot" 770 | echo "----------------------------------------" 771 | echo "TELEGRAM_BOT_USERNAME=@${CONFIG_TELEGRAMBOT_BOT_USERNAME}" 772 | echo "TELEGRAM_BOT_TOKEN=$CONFIG_TELEGRAMBOT_BOT_TOKEN" 773 | echo "TELEGRAM_BOT_LIMIT_PERMISSION=$CONFIG_TELEGRAMBOT_LIMIT_PERMISSION" 774 | echo "TELEGRAM_BOT_ALLOWED_USERNAMES=$CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES" 775 | echo 776 | echo "############################################################" 777 | echo "## DloadBox Internal Variables ##" 778 | echo "############################################################" 779 | echo "# Versions" 780 | echo "VERSION_DLOADBOX=$VERSION_DLOADBOX" 781 | echo "VERSION_DLOADBOX_CREATE=$VERSION_DLOADBOX_CREATE" 782 | echo "VERSION_DLOADBOX_UPDATE=$VERSION_DLOADBOX_UPDATE" 783 | echo "VERSION_FILEBROWSER=$VERSION_FILEBROWSER" 784 | echo "VERSION_ARIANG=$VERSION_ARIANG" 785 | echo "# Network" 786 | echo "INTERNALCONFIG_IP_MAIN=$CONFIG_IP_MAIN" 787 | echo "INTERNALCONFIG_INTERFACE_MAIN=$CONFIG_INTERFACE_MAIN" 788 | echo "# Aria2 config" 789 | echo "INTERNALCONFIG_ARIA2_RPC_SECRET=$CONFIG_ARIA2_RPC_SECRET" 790 | echo "INTERNALCONFIG_ARIA2_RPC_LISTEN_PORT=$CONFIG_ARIA2_RPC_LISTEN_PORT" 791 | echo "# Telegram Bot Config" 792 | echo "INTERNALCONFIG_TELEGRAMBOT_LIMIT_PERMISSION=$CONFIG_TELEGRAMBOT_LIMIT_PERMISSION" 793 | echo "INTERNALCONFIG_TELEGRAMBOT_ALLOWED_USERNAMES=$CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES" 794 | echo "INTERNALCONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET=$CONFIG_TELEGRAMBOT_ARIA2_RPC_SECRET" 795 | echo "INTERNALCONFIG_TELEGRAMBOT_ARIA2_RPC_URL=$CONFIG_TELEGRAMBOT_ARIA2_RPC_URL" 796 | echo "INTERNALCONFIG_TELEGRAMBOT_BOT_TOKEN=$CONFIG_TELEGRAMBOT_BOT_TOKEN" 797 | echo "INTERNALCONFIG_TELEGRAMBOT_BOT_USERNAME=$CONFIG_TELEGRAMBOT_BOT_USERNAME" 798 | echo "# Webserver config" 799 | echo "INTERNALCONFIG_WEBSERVER_PORT=$CONFIG_WEBSERVER_PORT" 800 | echo "# Filebrowser config" 801 | echo "INTERNALCONFIG_FILEBROWSER_PASSWORD=$CONFIG_FILEBROWSER_PASSWORD" 802 | echo "INTERNALCONFIG_FILEBROWSER_PASSWORD_HASH=$CONFIG_FILEBROWSER_PASSWORD_HASH" 803 | echo "INTERNALCONFIG_FILEBROWSER_USERNAME=$CONFIG_FILEBROWSER_USERNAME" 804 | echo "INTERNALCONFIG_FILEBROWSER_PORT=$CONFIG_FILEBROWSER_PORT" 805 | echo "# AriaNG config" 806 | echo "INTERNALCONFIG_ARIANG_URL=$CONFIG_ARIANG_URL" 807 | echo "INTERNALCONFIG_ARIANG_RPC_SECRET_HASH=$CONFIG_ARIANG_RPC_SECRET_HASH" 808 | } >> "$file_dloadbox_info" 809 | az_log bg "DloadBox Info file successfully changed" 810 | return 0 811 | } 812 | firewall_config() { 813 | local action="" 814 | local ports=() 815 | 816 | # Parse arguments 817 | while [[ $# -gt 0 ]]; do 818 | case "$1" in 819 | --allow|--remove) 820 | action="$1" 821 | shift 822 | ;; 823 | *) 824 | ports+=("$1") 825 | shift 826 | ;; 827 | esac 828 | done 829 | 830 | # Validate inputs 831 | if [ -z "$action" ]; then 832 | az_log br "❌ No action specified! Use --allow or --remove" 833 | return 1 834 | fi 835 | 836 | if [ ${#ports[@]} -eq 0 ]; then 837 | az_log br "❌ No ports specified!" 838 | return 1 839 | fi 840 | 841 | echo 842 | az_log sg "╔════════════════════════════════════════════════╗" 843 | az_log sg "║ Configuring Firewall Rules ║" 844 | az_log sg "╚════════════════════════════════════════════════╝" 845 | echo 846 | sleep 1 847 | 848 | # Check and configure UFW 849 | if command -v ufw >/dev/null 2>&1; then 850 | az_log b "🛡️ Configuring UFW firewall..." 851 | for port in "${ports[@]}"; do 852 | case "$action" in 853 | --allow) 854 | if ufw status | grep -q "$port"; then 855 | az_log bg "⚠️ Port $port is already allowed in UFW" 856 | else 857 | if ufw allow "$port/tcp" >/dev/null 2>&1; then 858 | az_log bg "✅ Successfully allowed port $port in UFW" 859 | else 860 | az_log br "❌ Failed to allow port $port in UFW" 861 | fi 862 | fi 863 | ;; 864 | --remove) 865 | if ufw status | grep -q "$port"; then 866 | if ufw delete allow "$port/tcp" >/dev/null 2>&1; then 867 | az_log bg "🗑️ Successfully removed port $port from UFW" 868 | else 869 | az_log br "❌ Failed to remove port $port from UFW" 870 | fi 871 | else 872 | az_log bg "⚠️ Port $port is not configured in UFW" 873 | fi 874 | ;; 875 | esac 876 | done 877 | ufw reload >/dev/null 2>&1 878 | az_log b "---------------------------------" 879 | fi 880 | 881 | # Check and configure firewalld 882 | if command -v firewall-cmd >/dev/null 2>&1; then 883 | az_log b "🛡️ Configuring firewalld..." 884 | if ! systemctl is-active --quiet firewalld; then 885 | systemctl start firewalld >/dev/null 2>&1 886 | fi 887 | for port in "${ports[@]}"; do 888 | case "$action" in 889 | --allow) 890 | if firewall-cmd --list-ports | grep -q "$port/tcp"; then 891 | az_log bg "⚠️ Port $port is already allowed in firewalld" 892 | else 893 | if firewall-cmd --permanent --add-port="$port/tcp" >/dev/null 2>&1; then 894 | az_log bg "✅ Successfully allowed port $port in firewalld" 895 | else 896 | az_log br "❌ Failed to allow port $port in firewalld" 897 | fi 898 | fi 899 | ;; 900 | --remove) 901 | if firewall-cmd --list-ports | grep -q "$port/tcp"; then 902 | if firewall-cmd --permanent --remove-port="$port/tcp" >/dev/null 2>&1; then 903 | az_log bg "🗑️ Successfully removed port $port from firewalld" 904 | else 905 | az_log br "❌ Failed to remove port $port from firewalld" 906 | fi 907 | else 908 | az_log bg "⚠️ Port $port is not configured in firewalld" 909 | fi 910 | ;; 911 | esac 912 | done 913 | firewall-cmd --reload >/dev/null 2>&1 914 | az_log b "---------------------------------" 915 | fi 916 | 917 | # Check and configure iptables 918 | if command -v iptables >/dev/null 2>&1; then 919 | az_log b "🛡️ Configuring iptables..." 920 | for port in "${ports[@]}"; do 921 | case "$action" in 922 | --allow) 923 | if iptables -L INPUT -n | grep -q "dpt:$port"; then 924 | az_log bg "⚠️ Port $port is already allowed in iptables" 925 | else 926 | if iptables -A INPUT -p tcp --dport "$port" -j ACCEPT >/dev/null 2>&1; then 927 | az_log bg "✅ Successfully allowed port $port in iptables" 928 | else 929 | az_log br "❌ Failed to allow port $port in iptables" 930 | fi 931 | fi 932 | ;; 933 | --remove) 934 | if iptables -L INPUT -n | grep -q "dpt:$port"; then 935 | if iptables -D INPUT -p tcp --dport "$port" -j ACCEPT >/dev/null 2>&1; then 936 | az_log bg "🗑️ Successfully removed port $port from iptables" 937 | else 938 | az_log br "❌ Failed to remove port $port from iptables" 939 | fi 940 | else 941 | az_log bg "⚠️ Port $port is not configured in iptables" 942 | fi 943 | ;; 944 | esac 945 | done 946 | 947 | # Save iptables rules for different systems 948 | if command -v iptables-save >/dev/null 2>&1; then 949 | if [ -d "/etc/iptables" ]; then 950 | iptables-save > /etc/iptables/rules.v4 2>/dev/null 951 | elif [ -f "/etc/sysconfig/iptables" ]; then 952 | iptables-save > /etc/sysconfig/iptables 2>/dev/null 953 | fi 954 | fi 955 | az_log b "---------------------------------" 956 | fi 957 | 958 | # If no supported firewall was found 959 | if ! command -v ufw >/dev/null 2>&1 && ! command -v firewall-cmd >/dev/null 2>&1 && ! command -v iptables >/dev/null 2>&1; then 960 | az_log br "❌ No supported firewall found on the system" 961 | return 1 962 | fi 963 | 964 | az_log bg "🎉 Firewall configuration completed successfully" 965 | } 966 | 967 | dloadbox_uninstall() { 968 | echo -n "Are you sure you want to remove dloadbox along with all its services, files, and settings? (y/n): " 969 | read -r uninstall_choice 970 | if [[ "$uninstall_choice" =~ ^[Nn]$ ]]; then 971 | az_log b "Uninstall canceled" 972 | sleep 2 973 | menu_uninstall_reinstall 974 | elif [[ "$uninstall_choice" =~ ^[Yy]$ ]]; then 975 | az_log b "🗑️ Uninstalling DloadBox..." 976 | LOG_FILE="/var/log/dloadbox-uninstall.log" 977 | true > "$LOG_FILE" 978 | else 979 | az_log br "Invalid input" 980 | sleep 2 981 | menu_uninstall_reinstall 982 | fi 983 | sleep 2 984 | az_log b "Reading DloadBox Configurations..." 985 | config_detector 986 | az_log b "🔄 Removing services..." 987 | service_manager --remove dloadbox-ariarpc dloadbox-caddy dloadbox-filebrowser dloadbox-telegrambot 988 | 989 | az_log b "🗑️ Removing installed packages..." 990 | rm -rf /usr/bin/*dloadbox* &>/dev/null 991 | rm -rf /etc/systemd/system/*dloadbox* &>/dev/null 992 | az_log b "📂 Removing files..." 993 | rm -rf /opt/dloadbox &>/dev/null 994 | if [ ! -d "/opt/dloadbox" ]; then 995 | az_log bg "✅ Files removed successfully" 996 | else 997 | az_log br "❌ Failed to remove files" 998 | fi 999 | 1000 | az_log b "👤 Removing user and group..." 1001 | userdel -r dloadbox &>/dev/null 1002 | groupdel dloadbox &>/dev/null 1003 | if ! id "dloadbox" &>/dev/null && ! grep -q "^dloadbox:" /etc/group; then 1004 | az_log bg "✅ User and group removed successfully" 1005 | else 1006 | az_log br "❌ Failed to remove user and group" 1007 | fi 1008 | az_log b "Removing firewall rules..." 1009 | firewall_config --remove "$CONFIG_WEBSERVER_PORT" "$CONFIG_ARIA2_RPC_LISTEN_PORT" "$CONFIG_FILEBROWSER_PORT" 1010 | az_log b "---------------------------------" 1011 | if [ ! -d "/opt/dloadbox" ] && ! id "dloadbox" &>/dev/null && ! grep -q "^dloadbox:" /etc/group; then 1012 | az_log bg "✅ Uninstallation completed successfully" 1013 | else 1014 | az_log br "❌ Uninstallation completed with some errors" 1015 | fi 1016 | az_log b "Done" 1017 | az_log b "---------------------------------" 1018 | az_log b "Uninstall log saved to $LOG_FILE" 1019 | sleep 1 1020 | az_log b "Feel free to open an issue on GitHub if you need help" 1021 | sleep 1 1022 | az_log b "https://github.com/dloadbox/dloadbox/issues" 1023 | sleep 1 1024 | az_log b "---------------------------------" 1025 | sleep 1 1026 | clear 1027 | reset 1028 | exit 0 1029 | 1030 | } 1031 | menu_main() { 1032 | clear 1033 | setup_static_header 1034 | echo -e "\n ${BOLD}${CYAN}MAIN MENU${NC}" 1035 | echo -e " ${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n" 1036 | echo -e " 1) ${GREEN}View DloadBox Access information (Coming Soon)${NC}" 1037 | echo -e " 2) ${GREEN}Manage DloadBox services (Coming Soon)${NC}" 1038 | echo -e " 3) ${GREEN}Change Configuration & Settings (Coming Soon)${NC}" 1039 | echo -e " 4) ${RED}Uninstall Or Reinstall Dloadbox${NC}" 1040 | echo -e " e) ${YELLOW}Exit${NC}" 1041 | echo -en "\nEnter your choice: " 1042 | read -r choice 1043 | case $choice in 1044 | 1) 1045 | menu_info 1046 | ;; 1047 | 2) 1048 | services_menu 1049 | ;; 1050 | 3) 1051 | settings_menu 1052 | ;; 1053 | 4) 1054 | menu_uninstall_reinstall 1055 | ;; 1056 | e) 1057 | echo "Exiting..." 1058 | clear 1059 | exit 0 1060 | ;; 1061 | *) 1062 | echo "Invalid choice, try again." 1063 | sleep 1 1064 | menu_main 1065 | ;; 1066 | esac 1067 | } 1068 | menu_info 1069 | services_menu() { 1070 | clear 1071 | setup_static_header 1072 | echo -e "\n ${BOLD}${CYAN}MAIN MENU > SERVICES${NC}" 1073 | echo -e " ${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n" 1074 | echo -e " 1) ${GREEN}Check DloadBox services status${NC}" 1075 | echo -e " 2) ${GREEN}Restart DloadBox services${NC}" 1076 | echo -e " 3) ${GREEN}Stop DloadBox services${NC}" 1077 | echo -e " 4) ${GREEN}Start DloadBox services${NC}" 1078 | echo -e " 0) ${YELLOW}Back to Main Menu${NC}" 1079 | echo -e " e) ${YELLOW}Exit${NC}" 1080 | echo -en "\nEnter your choice: " 1081 | read -r choice 1082 | case $choice in 1083 | 1) 1084 | check_services_status 1085 | ;; 1086 | 2) 1087 | restart_services_menu 1088 | ;; 1089 | 3) 1090 | stop_services_menu 1091 | ;; 1092 | 4) 1093 | start_services_menu 1094 | ;; 1095 | 0) 1096 | main_menu 1097 | ;; 1098 | e) 1099 | echo "Exiting..." 1100 | clear 1101 | exit 0 1102 | ;; 1103 | *) 1104 | echo "Invalid choice, try again." 1105 | sleep 1 1106 | services_menu 1107 | ;; 1108 | esac 1109 | } 1110 | menu_uninstall_reinstall(){ 1111 | clear 1112 | setup_static_header 1113 | echo -e "\n ${BOLD}${CYAN}MAIN MENU > UNINSTALL/REINSTALL${NC}" 1114 | echo -e " ${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n" 1115 | echo -e " 1) ${GREEN}Uninstall DloadBox${NC}" 1116 | #echo -e " 2) ${GREEN}Reinstall DloadBox${NC}" 1117 | echo -e " 0) ${YELLOW}Back to Main Menu${NC}" 1118 | echo -e " e) ${YELLOW}Exit${NC}" 1119 | echo -en "\nEnter your choice: " 1120 | read -r choice 1121 | case $choice in 1122 | 1) 1123 | dloadbox_uninstall 1124 | ;; 1125 | #2) 1126 | # reinstall_dloadbox 1127 | # ;; 1128 | 0) 1129 | menu_main 1130 | ;; 1131 | e) 1132 | echo "Exiting..." 1133 | clear 1134 | exit 0 1135 | ;; 1136 | *) 1137 | echo "Invalid choice, try again." 1138 | sleep 1 1139 | menu_uninstall_reinstall 1140 | ;; 1141 | esac 1142 | } 1143 | main() { 1144 | init_variables 1145 | setup_static_header 1146 | az_log b "Checking Requerments..." 1147 | check_hierarchy 1148 | if [[ "$CHECK_HIERARCHY_ISOK" == "false" ]]; then 1149 | az_log br "Error: Some DloadBox Files and Directories are missing, can't Continue" 1150 | exit 1 1151 | fi 1152 | az_log b "----------------------------------------" 1153 | az_log b "✨ System is ready to go..." 1154 | sleep 1 1155 | az_log b "🚀 Launching main menu..." 1156 | sleep 3 1157 | menu_main 1158 | } 1159 | main 1160 | -------------------------------------------------------------------------------- /bin/dloadbox-telegrambot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/bin/dloadbox-telegrambot -------------------------------------------------------------------------------- /config/dloadbox-aria2.conf: -------------------------------------------------------------------------------- 1 | # Directory Settings 2 | dir=/opt/dloadbox/downloads 3 | file-allocation=falloc 4 | 5 | # Download Settings 6 | max-connection-per-server=16 7 | max-concurrent-downloads=4 8 | min-split-size=25M 9 | max-overall-download-limit=0 10 | 11 | # RPC Settings 12 | rpc-allow-origin-all=true 13 | rpc-secret=xxxx 14 | disable-ipv6=true 15 | enable-rpc=true 16 | rpc-listen-all=true 17 | rpc-listen-port=6802 18 | 19 | # Session Management 20 | input-file=/var/tmp/aria2c.session 21 | save-session=/var/tmp/aria2c.session 22 | 23 | # Logging 24 | log=/opt/dloadbox/log/dloadbox-aria2-rpc.log 25 | console-log-level=warn 26 | log-level=notice 27 | 28 | # DHT and others 29 | enable-dht=true 30 | summary-interval=120 31 | timeout=600 32 | retry-wait=30 33 | max-tries=5 34 | -------------------------------------------------------------------------------- /config/dloadbox-ariang.conf: -------------------------------------------------------------------------------- 1 | # Redirect URL configuration for Ariang -------------------------------------------------------------------------------- /config/dloadbox-caddy.conf: -------------------------------------------------------------------------------- 1 | :6801 { 2 | root * /opt/dloadbox/www 3 | file_server 4 | 5 | basicauth / { 6 | dloadbox XXX 7 | } 8 | log { 9 | output file /opt/dloadbox/log/dloadbox-caddy.log 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /config/dloadbox-filebrowser.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "0.0.0.0", 3 | "database": "/opt/dloadbox/config/dloadbox-filebrowser.db", 4 | "log": "/opt/dloadbox/log/dloadbox-filebrowser.log", 5 | "port": 6803, 6 | "root": "/opt/dloadbox/downloads", 7 | "username": "dloadboxadmin", 8 | "password": "xxxxxxxxxxxxxxxxxxxxxxxxx" 9 | } 10 | -------------------------------------------------------------------------------- /config/dloadbox-telegrambot.conf: -------------------------------------------------------------------------------- 1 | LIMIT_PERMISSION=false 2 | ALLOWED_USERNAMES=username1,username2,username3 3 | ARIA2_RPC_SECRET=token:xxxx 4 | ARIA2_RPC_URL=http://xxxx 5 | BOT_TOKEN=7403668655:AAFlaxxxxx 6 | LOG_FILE_PATH=/opt/dloadbox/log/dloadbox-telegrambot.log 7 | -------------------------------------------------------------------------------- /config/dloadbox.conf: -------------------------------------------------------------------------------- 1 | CONFIG_IP_MAIN="" 2 | CONFIG_ARIA2_RPC_SECRET="" 3 | CONFIG_ARIA2_RPC_LISTEN_PORT="" 4 | CONFIG_WEBSERVER_PORT="" 5 | CONFIG_CADDY_PASSWORD="" 6 | CONFIG_FILEBROWSER_PASSWORD="" 7 | CONFIG_FILEBROWSER_PORT="" 8 | CONFIG_TELEGRAMBOT_BOT_TOKEN="" 9 | CONFIG_TELEGRAMBOT_LIMIT_PERMISSION="" 10 | CONFIG_TELEGRAMBOT_ALLOWED_USERNAMES="" -------------------------------------------------------------------------------- /dloadbox-info: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # # 3 | # !!! DO NOT EDIT THIS FILE MANUALLY !!! # 4 | # # 5 | ############################################################ 6 | # This file is automatically generated and managed by DloadBOX. 7 | # Manual changes to this file will have no effect on DloadBOX settings and may cause errors. 8 | # To modify DloadBOX settings, please run the 'dloadbox' command in your terminal and follow the setup process. 9 | ############################################################ 10 | -------------------------------------------------------------------------------- /downloads/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /images/1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/1.JPG -------------------------------------------------------------------------------- /images/10.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/10.JPG -------------------------------------------------------------------------------- /images/11.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/11.JPG -------------------------------------------------------------------------------- /images/2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/2.JPG -------------------------------------------------------------------------------- /images/3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/3.JPG -------------------------------------------------------------------------------- /images/4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/4.JPG -------------------------------------------------------------------------------- /images/5.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/5.JPG -------------------------------------------------------------------------------- /images/6.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/6.JPG -------------------------------------------------------------------------------- /images/7.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/7.JPG -------------------------------------------------------------------------------- /images/8.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/8.JPG -------------------------------------------------------------------------------- /images/9.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/images/9.JPG -------------------------------------------------------------------------------- /log/dloadbox-aria2-rpc.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/log/dloadbox-aria2-rpc.log -------------------------------------------------------------------------------- /log/dloadbox-caddy.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/log/dloadbox-caddy.log -------------------------------------------------------------------------------- /services/dloadbox-ariarpc.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=DloadBox Aria RPC 3 | After=network-online.target 4 | Wants=network-online.target 5 | 6 | [Service] 7 | Type=simple 8 | User=root 9 | Group=root 10 | ExecStartPre=/usr/bin/env touch /var/tmp/aria2c.session 11 | ExecStartPre=/bin/sleep 10 12 | ExecStart=/opt/dloadbox/bin/dloadbox-aria2c --console-log-level=warn --enable-rpc --rpc-listen-all --conf-path=/opt/dloadbox/config/dloadbox-aria2.conf 13 | TimeoutStopSec=20 14 | Restart=on-failure 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /services/dloadbox-caddy.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Caddy 3 | Documentation=https://caddyserver.com/docs/ 4 | After=network.target network-online.target 5 | Requires=network-online.target 6 | 7 | [Service] 8 | ExecStart=/opt/dloadbox/bin/dloadbox-caddy run --config /opt/dloadbox/config/dloadbox-caddy.conf --adapter caddyfile 9 | Restart=always 10 | User=root 11 | Group=root 12 | LimitNOFILE=1048576 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | -------------------------------------------------------------------------------- /services/dloadbox-filebrowser.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=DloadBox Filebrowser 3 | After=network.target 4 | 5 | [Service] 6 | ExecStart=/usr/bin/dloadbox-filebrowser -c /opt/dloadbox/config/dloadbox-filebrowser.json 7 | 8 | [Install] 9 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /services/dloadbox-telegrambot.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=DloadBox Telegram Bot 3 | After=network.target 4 | 5 | [Service] 6 | ExecStart=/opt/dloadbox/bin/dloadbox-telegrambot 7 | 8 | [Install] 9 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /services/dloadbox.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Main service for dloadbox components 3 | Requires=dloadbox-ariarpc.service dloadbox-caddy.service dloadbox-filebrowser.service dloadbox-telegrambot.service 4 | BindsTo=dloadbox-ariarpc.service dloadbox-caddy.service dloadbox-filebrowser.service dloadbox-telegrambot.service 5 | Before=dloadbox-ariarpc.service dloadbox-caddy.service dloadbox-filebrowser.service dloadbox-telegrambot.service 6 | 7 | [Service] 8 | Type=notify 9 | RemainAfterExit=true 10 | ExecStartPre=/opt/dloadbox/bin/dloadbox-configurator.sh 11 | ExecStart=/bin/true 12 | ExecStop=/bin/true 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | -------------------------------------------------------------------------------- /source/dloadbox-telegrambot.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import logging 3 | import os 4 | from telegram import Update 5 | from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, ContextTypes 6 | from telegram.ext import filters 7 | 8 | # Function to load configuration from a .conf file 9 | def load_config(file_path): 10 | config = {} 11 | if not os.path.exists(file_path): 12 | # Log error if config file is missing 13 | logger.error(f"Config file not found: {file_path}") 14 | raise FileNotFoundError(f"Config file not found: {file_path}") 15 | 16 | with open(file_path, "r") as file: 17 | for line in file: 18 | line = line.strip() 19 | if "=" in line and not line.startswith("#"): # Ignore comments 20 | key, value = line.split("=", 1) 21 | config[key.strip()] = value.strip() 22 | return config 23 | 24 | # Set up logging to log to the specified file path 25 | LOG_FILE_PATH = "/opt/dloadbox/log/dloadbox-telegrambot.log" 26 | logging.basicConfig( 27 | filename=LOG_FILE_PATH, 28 | level=logging.DEBUG, 29 | format="%(asctime)s - %(message)s", 30 | ) 31 | 32 | logger = logging.getLogger(__name__) 33 | 34 | # Default config file path 35 | CONFIG_FILE_PATH = "/opt/dloadbox/config/dloadbox-telegrambot.conf" 36 | 37 | # Load configuration settings (with error handling if the config file is missing) 38 | try: 39 | config = load_config(CONFIG_FILE_PATH) 40 | # Assign configuration variables 41 | LIMIT_PERMISSION = config["LIMIT_PERMISSION"] == "true" 42 | ALLOWED_USERNAMES = config["ALLOWED_USERNAMES"].split(",") 43 | ARIA2_RPC_SECRET = config["ARIA2_RPC_SECRET"] 44 | ARIA2_RPC_URL = config["ARIA2_RPC_URL"] 45 | BOT_TOKEN = config["BOT_TOKEN"] 46 | LOG_FILE_PATH = config["LOG_FILE_PATH"] 47 | except FileNotFoundError as e: 48 | logger.error(str(e)) # Log the error 49 | exit(1) # Exit if config is missing 50 | 51 | # Function to check if the URL is valid 52 | def is_valid_url(url): 53 | try: 54 | response = requests.head(url, timeout=10) 55 | if response.status_code // 100 == 2: 56 | return True 57 | else: 58 | return False 59 | except requests.RequestException as e: 60 | # Log error if URL check fails 61 | logger.error(f"Error checking URL {url}: {str(e)} ❌") 62 | return False 63 | 64 | # Function to add a URI to Aria2 (downloads a file) 65 | async def add_uri_to_aria2(uri): 66 | payload = { 67 | "jsonrpc": "2.0", 68 | "method": "aria2.addUri", 69 | "id": "1", 70 | "params": [ARIA2_RPC_SECRET, [uri]], 71 | } 72 | response = requests.post(ARIA2_RPC_URL, json=payload) 73 | return response.json() 74 | 75 | # Handle /start command (welcomes the user) 76 | async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): 77 | await update.message.reply_text("🚀 Welcome! Send me a download link to start. 🚀") 78 | 79 | # Handle incoming messages (parse download link and add to Aria2) 80 | async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE): 81 | # Get the download link from the message 82 | message_text = update.message.text 83 | 84 | # Check if the username is allowed to access the bot 85 | if LIMIT_PERMISSION: 86 | user_username = update.message.from_user.username 87 | if user_username not in ALLOWED_USERNAMES: 88 | # Send message if the user is not allowed 89 | await update.message.reply_text(f"❌ Your access to this bot is restricted (username: {user_username})\nYou can request to have your username added to the Dloadbox server.") 90 | logger.error(f"Unauthorized access attempt by {user_username} ❌") 91 | return 92 | 93 | if not message_text.startswith("http"): 94 | await update.message.reply_text("❌ Please send a valid URL. ❌") 95 | return 96 | 97 | # Check if the URL is valid 98 | if not is_valid_url(message_text): 99 | await update.message.reply_text("❌ The link is not valid or cannot be downloaded. ❌") 100 | logger.error(f"Invalid URL attempted: {message_text} ❌") 101 | return 102 | 103 | # Add the URI to Aria2 for download 104 | response = await add_uri_to_aria2(message_text) 105 | if "result" in response: 106 | gid = response["result"] 107 | # Sending download success message 108 | success_message = f"✅ Download added successfully. GID: {gid} ✅" 109 | 110 | # Send the success message without any link 111 | await update.message.reply_text(success_message) 112 | 113 | elif "error" in response: 114 | await update.message.reply_text(f"❌ Error: {response['error']['message']} ❌") 115 | logger.error(f"Error adding URL to Aria2: {response['error']['message']} ❌") 116 | else: 117 | await update.message.reply_text("❌ An unknown error occurred. ❌") 118 | logger.error("Unknown error occurred while adding URL to Aria2. ❌") 119 | 120 | # Main function to start the bot 121 | def main(): 122 | # Build the application and set up token 123 | app = ApplicationBuilder().token(BOT_TOKEN).build() 124 | 125 | # Add command handlers for /start command 126 | app.add_handler(CommandHandler("start", start)) 127 | app.add_handler(MessageHandler(filters.TEXT & ~filters.Regex(r"^/"), handle_message)) 128 | 129 | # Run the bot continuously (polling) 130 | app.run_polling() 131 | 132 | if __name__ == "__main__": 133 | main() 134 | -------------------------------------------------------------------------------- /www/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azolfagharj/DloadBox/00d85f2d8bc9eb13ce59ecf5aecf378d5023764c/www/.gitkeep -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Redirecting... 7 | 25 | 26 | 27 |

If you are not redirected, click here.

28 | 29 | 30 | --------------------------------------------------------------------------------