├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .prettierignore ├── .prettierrc.json ├── .travis.yml ├── .vscode └── Gindex.code-workspace ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── backend ├── .gitignore ├── Procfile ├── README.md ├── app.js ├── app.json ├── models │ ├── categoryPost.js │ ├── heroPost.js │ ├── invitedUser.js │ ├── pendingUser.js │ ├── quickLink.js │ ├── sessionSchema.js │ ├── siteSettings.js │ ├── spamUser.js │ ├── trendingPost.js │ └── user.js ├── package-lock.json ├── package.json ├── parsers │ ├── torrent-name-parser-one │ │ ├── index.js │ │ └── src │ │ │ ├── handlers.js │ │ │ └── parser.js │ └── torrent-name-parser-two │ │ ├── core.js │ │ ├── index.js │ │ └── parts │ │ ├── common.js │ │ ├── excess.js │ │ └── title.js ├── plugins │ ├── checkOrigin.js │ ├── deleteAll.js │ ├── deleteInvitedUsers.js │ ├── deletePendingUsers.js │ ├── deleteUsers.js │ ├── jwtVerify.js │ ├── keepAlive.js │ └── mailtransporter.js ├── public │ └── css │ │ └── styles.css ├── routes │ ├── approve │ │ └── index.js │ ├── delete.js │ ├── get.js │ ├── getspam │ │ └── index.js │ ├── index.js │ ├── invite.js │ ├── login.js │ ├── media.js │ ├── pending │ │ └── index.js │ ├── ping.js │ ├── poster.js │ ├── posters │ │ ├── categories │ │ │ └── index.js │ │ ├── hero │ │ │ └── index.js │ │ ├── quicklinks │ │ │ └── index.js │ │ └── trending │ │ │ └── index.js │ ├── register.js │ ├── remove │ │ ├── index.js │ │ └── spam.js │ ├── request.js │ ├── settings.js │ ├── spam.js │ └── user.js ├── templates │ ├── delete │ │ ├── invitedUsers │ │ │ └── toAll.js │ │ ├── pending │ │ │ └── toAll.js │ │ └── users │ │ │ ├── toNonVerified.js │ │ │ ├── toSelf.js │ │ │ └── toUsers.js │ ├── invite │ │ └── toUsers.js │ ├── register │ │ ├── toPromotedUsers.js │ │ ├── toUsers.js │ │ └── toVerifiedUser.js │ ├── request │ │ ├── existing │ │ │ ├── forgotPass.js │ │ │ ├── toAdmin.js │ │ │ └── toUser.js │ │ └── newUser │ │ │ ├── toAdmin.js │ │ │ └── toUser.js │ └── spam │ │ ├── removeUser.js │ │ └── toAll.js └── views │ ├── dashboard.ejs │ ├── footer.ejs │ ├── generate.ejs │ ├── header.ejs │ └── signup.ejs ├── cli-tool ├── .gitignore ├── README.md ├── commands │ ├── configure │ │ ├── env │ │ │ ├── checkHerokuLogin.js │ │ │ ├── index.js │ │ │ ├── inputPrompts.js │ │ │ └── pushConfigKeys.js │ │ └── index.js │ ├── deploy │ │ ├── backend │ │ │ ├── checkHerokuLogin.js │ │ │ ├── checkHerokuPresent.js │ │ │ ├── createHerokuApp.js │ │ │ ├── createTMP.js │ │ │ ├── downloadUnzip.js │ │ │ ├── getReleases.js │ │ │ ├── gitCheckoutHApp.js │ │ │ ├── gitPushHeroku.js │ │ │ ├── index.js │ │ │ ├── initBackendnCommit.js │ │ │ ├── inputPrompts.js │ │ │ └── pushConfigKeys.js │ │ ├── frontend │ │ │ ├── getAllPrompts.js │ │ │ ├── getLatIndex.js │ │ │ ├── index.js │ │ │ ├── inputPrompts.js │ │ │ └── replaceOpt.js │ │ └── index.js │ ├── index.js │ ├── init │ │ ├── checkGitExists.js │ │ ├── checkNpmExists.js │ │ ├── index.js │ │ └── post-init.js │ └── update │ │ ├── checkHerokuLogin.js │ │ ├── createTMP.js │ │ ├── downloadUnzip.js │ │ ├── getReleases.js │ │ ├── gitCheckoutHApp.js │ │ ├── index.js │ │ ├── initBackendnCommit.js │ │ ├── inputPrompts.js │ │ └── pushBackend.js ├── displays │ ├── initial-render.js │ └── post-install.js ├── helpers │ ├── configStore.js │ └── spinner.js ├── index.js ├── package-lock.json └── package.json ├── imgs ├── adminpage.jpg ├── home-nolog.png ├── home.png ├── home2.png ├── homelogged.jpeg ├── homelogout.jpg ├── login.jpg ├── newuserregister.jpg ├── pendinguser.jpeg ├── request.jpeg ├── settings.jpg ├── verify.jpeg ├── videoPlayer Modal.jpg ├── videoPlayer.jpg └── videplayer2.jpg ├── scripts ├── before-build.sh ├── dev-after-deploy.sh ├── dev-build.sh ├── dev-deploy.sh ├── dev-release.sh ├── install.sh ├── prod-after-deploy.sh ├── prod-build.sh ├── prod-deploy.sh └── prod-release.sh ├── version-manager ├── .gitignore ├── app.js ├── helpers │ ├── get-commits.js │ ├── get-diff.js │ ├── get-releases.js │ ├── push-release.js │ └── spinner.js ├── package-lock.json ├── package.json ├── publish │ ├── checks.js │ ├── handle-publish.js │ └── index.js └── templates │ └── publish-release.js ├── version.json ├── vetur.config.js ├── vuejs ├── .browserslistrc ├── .eslintrc.json ├── .gitignore ├── .yarn │ ├── build-state.yml │ ├── install-state.gz │ ├── plugins │ │ └── @yarnpkg │ │ │ └── plugin-interactive-tools.cjs │ └── releases │ │ └── yarn-berry.js ├── .yarnrc.yml ├── LICENSE ├── README.md ├── babel.config.js ├── jsconfig.json ├── package.json ├── public │ ├── images │ │ ├── airplane.gif │ │ ├── baidu-pan-logo.png │ │ ├── eyes.png │ │ ├── g-logo.png │ │ ├── no-data.png │ │ └── player │ │ │ ├── aria2.png │ │ │ ├── iina.png │ │ │ ├── mxplayer.png │ │ │ ├── nplayer.png │ │ │ ├── potplayer.png │ │ │ ├── thunder.png │ │ │ └── vlc.png │ └── index.html ├── rules.md ├── scripts │ ├── others │ │ ├── build-theme.sh │ │ ├── buildAll.sh │ │ └── serve-theme.sh │ └── windows │ │ ├── build-theme.bat │ │ ├── buildAll.bat │ │ └── serve-theme.bat ├── src │ ├── App.vue │ ├── components │ │ ├── BreadCrumb.vue │ │ ├── Footer.vue │ │ ├── Markdown.vue │ │ ├── Navbar.vue │ │ ├── grid.vue │ │ ├── list.vue │ │ ├── notification.js │ │ └── viewmode.vue │ ├── libs │ │ ├── util.cdn.js │ │ ├── util.import.development.js │ │ └── util.import.production.js │ ├── main.js │ ├── plugin │ │ ├── aplayer │ │ │ └── index.js │ │ └── axios │ │ │ └── index.js │ ├── router │ │ ├── index.js │ │ └── routes.js │ ├── styles │ │ ├── base.scss │ │ ├── carnation │ │ │ └── register.scss │ │ ├── curious-blue │ │ │ └── register.scss │ │ ├── emerald │ │ │ └── register.scss │ │ ├── ice-cold │ │ │ └── register.scss │ │ ├── konifer │ │ │ └── register.scss │ │ ├── kournikova │ │ │ └── register.scss │ │ ├── mona-lisa │ │ │ └── register.scss │ │ ├── netflix-red │ │ │ └── register.scss │ │ ├── persian-rose │ │ │ └── register.scss │ │ ├── purple-heart │ │ │ └── register.scss │ │ ├── purple-mountains-majesty │ │ │ └── register.scss │ │ ├── salmon │ │ │ └── register.scss │ │ ├── selective-yellow │ │ │ └── register.scss │ │ ├── shamrock │ │ │ └── register.scss │ │ └── witch-haze │ │ │ └── register.scss │ ├── themeConfigs.js │ ├── themeManager.js │ ├── utils │ │ ├── AcrouUtil.js │ │ ├── backendUtils.js │ │ ├── encryptUtils.js │ │ ├── localUtils.js │ │ └── playUtils.js │ └── views │ │ ├── GoAudio.vue │ │ ├── GoImg.vue │ │ ├── GoList.vue │ │ ├── GoOthers.vue │ │ ├── GoPdf.vue │ │ ├── GoText.vue │ │ ├── GoVideo.vue │ │ └── static │ │ ├── Admin │ │ ├── AdminArea.vue │ │ ├── Invite.vue │ │ ├── MainManagePostPage.vue │ │ ├── ManagePosts │ │ │ ├── ManageCategories.vue │ │ │ ├── ManageHeros.vue │ │ │ ├── ManageQuickLinks.vue │ │ │ └── ManageTrendingPosts.vue │ │ ├── ManageSpamUsers.vue │ │ ├── ManageUsers.vue │ │ ├── Register.vue │ │ └── SiteSettings.vue │ │ ├── Home.vue │ │ ├── OtpRegister.vue │ │ ├── Request.vue │ │ ├── ResultPage.vue │ │ └── Users │ │ ├── ChangePassword.vue │ │ ├── DeleteMe.vue │ │ ├── Login.vue │ │ ├── RequestPrivs.vue │ │ └── Settings.vue ├── vue.config.js ├── webpack.config.js ├── webpack │ ├── chain-webpack.js │ ├── css-options.js │ ├── custom-plugins │ │ ├── buildAppJSPlugin.js │ │ └── dependencies-cdn.js │ ├── dev-server.js │ ├── index.js │ ├── loaders.js │ ├── minimizers.js │ ├── optimizations.js │ ├── plugins.js │ └── resolvers.js └── yarn.lock └── worker └── index.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: tks18 2 | custom: ['paypal.me/shantk18', 'buymeacoffee.com/shantk18'] 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | webpack.config.js -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "semi": true, 5 | "singleQuote": true 6 | } 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: linux 2 | branches: 3 | only: 4 | - master 5 | - dev 6 | language: node_js 7 | node_js: 8 | - 14 9 | 10 | git: 11 | depth: 3 12 | quiet: true 13 | submodules: false 14 | 15 | cache: 16 | directories: 17 | - vuejs/.yarn/cache 18 | - vuejs/node_modules 19 | 20 | install: bash ./scripts/install.sh 21 | 22 | script: bash ./scripts/before-build.sh 23 | 24 | deploy: 25 | - provider: script 26 | skip_cleanup: true 27 | script: bash ./scripts/prod-deploy.sh 28 | on: 29 | branch: master 30 | 31 | - provider: script 32 | skip_cleanup: true 33 | script: bash ./scripts/dev-deploy.sh 34 | on: 35 | branch: dev 36 | -------------------------------------------------------------------------------- /.vscode/Gindex.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "name": "Root", 5 | "path": "../" 6 | }, 7 | { 8 | "name": "Front-end", 9 | "path": "../vuejs" 10 | }, 11 | { 12 | "name": "Back-end", 13 | "path": "../backend" 14 | }, 15 | { 16 | "name": "CLI Tool", 17 | "path": "../cli-tool" 18 | }, 19 | { 20 | "name": "Version Manager", 21 | "path": "../version-manager" 22 | }, 23 | { 24 | "name": "Worker", 25 | "path": "../worker" 26 | } 27 | ], 28 | "settings": { 29 | "files.exclude": { 30 | "node_modules/": true, 31 | "packages/": true, 32 | "vuejs/": true, 33 | "backend/": true, 34 | "cli-tool/": true, 35 | "worker/": true, 36 | "version-manager/": true 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 7.3.0 | :white_check_mark: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | Use this section to tell people how to report a vulnerability. 15 | 16 | Tell them where to go, how often they can expect to get an update on a 17 | reported vulnerability, what to expect if the vulnerability is accepted or 18 | declined, etc. 19 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | glorydb 3 | .env 4 | -------------------------------------------------------------------------------- /backend/Procfile: -------------------------------------------------------------------------------- 1 | web: npm run start 2 | -------------------------------------------------------------------------------- /backend/README.md: -------------------------------------------------------------------------------- 1 | Creative Commons License
Google Drive Index by Sudharshan TK is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Based on a work at https://github.com/tks18/gindex-v4 2 | 3 | ##### What if Someone Violates my License ? 4 | 5 | A CC license terminates automatically when its conditions are violated. For example, if a reuser of CC-licensed material does not provide the attribution required when sharing the work, then the user no longer has the right to continue using the material and may be liable for copyright infringement. The license is terminated for the user who violated the license. However, all other users still have a valid license, so long as they are in compliance. 6 | 7 | Under the 4.0 licenses, a licensee automatically gets these rights back if she fixes the violation within 30 days of discovering it. 8 | 9 | If you apply a Creative Commons license and a user violates the license conditions, you may opt to contact the person directly to ask them to rectify the situation or consult a lawyer to act on your behalf. Creative Commons is not a law firm and cannot represent you or give you legal advice, but there are lawyers who have identified themselves as interested in representing people in CC-related matters. 10 | 11 | # gindex-backend 12 | Backend for gindex for Maintaining User Database 13 | 14 | **Support Group can be Found Here - [Here](https://t.me/joinchat/LVLR1U5Gs_9lmHGNGqpxIw)**
15 | Any Issues / Help Regarding Setup, Contact Through the telegram Group 16 | 17 | ##### without this the Main GIndex wont work, Both should run simultaneously. 18 | 19 | #### Deploy to Heroku Directly: 20 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2Ftks18%2Fgindex-backend%2Ftree%2Fmaster) 21 | -------------------------------------------------------------------------------- /backend/app.js: -------------------------------------------------------------------------------- 1 | // Inititalisation 2 | require('dotenv').config(); 3 | const express = require("express"); 4 | var ping = require('ping'); 5 | const cors = require('cors'); 6 | const bodyParser = require("body-parser"); 7 | const mongoose = require("mongoose"); 8 | const keepAlive = require("./plugins/keepAlive"); 9 | const deletePlugin = require('./plugins/deleteAll'); 10 | const app = express(); 11 | 12 | app.use(express.static("public")); 13 | app.set("view engine", "ejs"); 14 | app.use(bodyParser.urlencoded({extended: false})); 15 | app.use(bodyParser.json()); 16 | app.use(cors()); 17 | 18 | mongoose.connect(process.env.DBURL, {useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true}) 19 | 20 | //Routes 21 | app.use('/', require('./routes/index')); 22 | app.use('/login', require('./routes/login')); 23 | app.use('/ping', require('./routes/ping')); 24 | app.use('/request', require('./routes/request')); 25 | app.use('/user', require('./routes/user')); 26 | app.use('/media', require('./routes/media')); 27 | app.use('/posters', require('./routes/poster')); 28 | app.use('/register', require('./routes/register')); 29 | app.use('/invite', require('./routes/invite')); 30 | app.use('/delete', require('./routes/delete')); 31 | app.use('/settings', require('./routes/settings')); 32 | app.use('/get', require('./routes/get')); 33 | app.use('/spam', require('./routes/spam')); 34 | 35 | deletePlugin(); 36 | keepAlive(); 37 | const PORT = process.env.PORT || 3000; 38 | 39 | app.listen(PORT, console.log('Server Started on ' + PORT )); 40 | -------------------------------------------------------------------------------- /backend/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "G-Index Backend", 3 | "description": "This is the Live Backend Server for G-Index for Authenticating Users", 4 | "repository": "https://github.com/tks18/gindex-backend", 5 | "keywords": ["gindex-backend"], 6 | "env": { 7 | "DBURL": { 8 | "description": "MongoDB Atlas Connect URL for Your Database", 9 | "required": true 10 | }, 11 | "SITE": { 12 | "description": "This is your Heroku's Backend Site Address. This is to Keep the Site Alive Every Half Hour.", 13 | "required": true 14 | }, 15 | "EMAILID": { 16 | "description": "EmailID From Which OTP and Verification Emails will be Sent.", 17 | "required": true 18 | }, 19 | "EMAILPASS": { 20 | "description": "Above Email ID's Password", 21 | "required": true 22 | }, 23 | "EMAILSMTP": { 24 | "description": "SMTP Domain of your Email Service Provider", 25 | "required": true 26 | }, 27 | "EMAILPORT": { 28 | "description": "Port of Your Email Service Provider", 29 | "required": true 30 | }, 31 | "EMAILSERVICE": { 32 | "description": "Name of Your Email Service Provider. Example: Google, Yandex.., etc. Like that", 33 | "required": true 34 | }, 35 | "ADMINEMAIL": { 36 | "description": "Whenever a User Registers or Verifies them. Their Details will be Sent to this Mail. Can be Same as Above Email ID", 37 | "required": true 38 | }, 39 | "REPLYTOMAIL": { 40 | "description": "Whenver a User Replies to a Mail. That will be Sent to this Email ID", 41 | "required": true 42 | }, 43 | "SITESECRET": { 44 | "description": "Can be Anything. This will be Asked When you are Setting up the Root User in Backend to Verify that its You.", 45 | "required": true 46 | }, 47 | "FRONTENDSITENAME": { 48 | "description": "Your G-Index Name. Can be Anything", 49 | "required": true 50 | }, 51 | "TMDBAPI": { 52 | "description": "Give Your TMDB V3 API Key for Automatic pulling of Video Data.", 53 | "required": false 54 | }, 55 | "FRONTENDURL": { 56 | "description": "Your G-index Domain. This is Must, Otherwise Authentication will Fail.", 57 | "required": true 58 | }, 59 | "TOKENSECRET": { 60 | "description": "Can be Anything. This will be Used to Issue JSON Web Tokens and Verify it. Recommended to Have Minimum 20 Characters. That will be Safe.", 61 | "required": true 62 | }, 63 | "MAXSESSIONS": { 64 | "description": "Number of Sessions a User can Login", 65 | "required": true 66 | } 67 | }, 68 | "buildpacks": [ 69 | { 70 | "url": "heroku/nodejs" 71 | } 72 | ] 73 | } 74 | -------------------------------------------------------------------------------- /backend/models/categoryPost.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | // Category Posters Schema 4 | const categoryPostSchema = { 5 | root: { 6 | type: Number, 7 | required: true, 8 | }, 9 | title: { 10 | type: String, 11 | required: true, 12 | }, 13 | poster: { 14 | type: String, 15 | required: true, 16 | }, 17 | link: { 18 | type: String, 19 | required: true, 20 | }, 21 | } 22 | 23 | const CategoryPost = mongoose.model("CategoryPost", categoryPostSchema); 24 | 25 | module.exports = CategoryPost; 26 | -------------------------------------------------------------------------------- /backend/models/heroPost.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | // Hero Posters Schema 4 | const heroPostSchema = { 5 | root: { 6 | type: Number, 7 | required: true, 8 | }, 9 | title: { 10 | type: String, 11 | required: true, 12 | }, 13 | subtitle: { 14 | type: String, 15 | required: true, 16 | }, 17 | poster: { 18 | type: String, 19 | required: true, 20 | }, 21 | link: { 22 | type: String, 23 | required: true, 24 | }, 25 | } 26 | 27 | const HeroPost = mongoose.model("HeroPost", heroPostSchema); 28 | 29 | module.exports = HeroPost; 30 | -------------------------------------------------------------------------------- /backend/models/invitedUser.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const invitedUserSchema = { 4 | name: { 5 | type: String, 6 | required: true 7 | }, 8 | post: { 9 | type: String, 10 | required: true 11 | }, 12 | email: { 13 | type: String, 14 | lowercase: true, 15 | required: true, 16 | unique: true 17 | }, 18 | invitedDate: { 19 | type: Number, 20 | required: true, 21 | default: Date.now, 22 | }, 23 | message: { 24 | type: String 25 | }, 26 | invitedby: { 27 | type: String, 28 | lowercase: true, 29 | required: true 30 | } 31 | }; 32 | 33 | const InvitedUser = mongoose.model("InvitedUser", invitedUserSchema); 34 | 35 | module.exports = InvitedUser; 36 | -------------------------------------------------------------------------------- /backend/models/pendingUser.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | // Pending User Database Model 4 | const pendingUserSchema = { 5 | name: { 6 | type: String, 7 | required: true 8 | }, 9 | post: { 10 | type: String, 11 | required: true 12 | }, 13 | drive: { 14 | type: Number, 15 | required: true, 16 | }, 17 | pendingFrom: { 18 | type: Number, 19 | required: true, 20 | default: Date.now, 21 | }, 22 | email: { 23 | type: String, 24 | lowercase: true, 25 | required: true, 26 | unique: true }, 27 | message: { 28 | type: String 29 | } 30 | }; 31 | 32 | const PendingUser = mongoose.model("PendingUser", pendingUserSchema); 33 | 34 | module.exports = PendingUser; 35 | -------------------------------------------------------------------------------- /backend/models/quickLink.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | // Category Posters Schema 4 | const quickLinkSchema = { 5 | root: { 6 | type: Number, 7 | required: true, 8 | }, 9 | title: { 10 | type: String, 11 | required: true, 12 | }, 13 | link: { 14 | type: String, 15 | required: true, 16 | }, 17 | } 18 | 19 | const QuickLink = mongoose.model("QuickLink", quickLinkSchema); 20 | 21 | module.exports = QuickLink; 22 | -------------------------------------------------------------------------------- /backend/models/sessionSchema.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const sessionSchema = new mongoose.Schema({ 4 | ip: { 5 | type: String, 6 | required: true 7 | }, 8 | sessionid: { 9 | type: String, 10 | required: true 11 | }, 12 | token: { 13 | type: String, 14 | required: true 15 | }, 16 | time: { 17 | type: Number, 18 | required: true, 19 | } 20 | }) 21 | 22 | module.exports = sessionSchema; 23 | -------------------------------------------------------------------------------- /backend/models/siteSettings.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const siteSettingsSchema = { 4 | cId: { 5 | type: String, 6 | required: true, 7 | default: process.env.FRONTENDSITENAME, 8 | }, 9 | requests: { 10 | type: Boolean, 11 | required: true, 12 | default: true, 13 | }, 14 | adminRequests: { 15 | type: Boolean, 16 | required: true, 17 | default: true, 18 | }, 19 | tmdb: { 20 | type: Boolean, 21 | required: true, 22 | default: false, 23 | }, 24 | otpVerify: { 25 | type: Boolean, 26 | required: true, 27 | default: true, 28 | }, 29 | useMailing: { 30 | type: Boolean, 31 | required: true, 32 | default: true, 33 | }, 34 | }; 35 | 36 | const Settings = mongoose.model('Settings', siteSettingsSchema); 37 | 38 | module.exports = Settings; 39 | -------------------------------------------------------------------------------- /backend/models/spamUser.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const spamUserSchema = { 4 | name: { 5 | type: String, 6 | required: true 7 | }, 8 | email: { 9 | type: String, 10 | required: true, 11 | unique: true, 12 | lowercase: true 13 | }, 14 | post: { 15 | type: String, 16 | required: true 17 | }, 18 | flaggedby: { 19 | type: String, 20 | required: true, 21 | lowercase: true 22 | }, 23 | reason: { 24 | type: String, 25 | required: true 26 | } 27 | } 28 | 29 | const SpamUser = mongoose.model("SpamUser", spamUserSchema); 30 | 31 | module.exports = SpamUser; 32 | -------------------------------------------------------------------------------- /backend/models/trendingPost.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | // Trending Posters Schema 4 | const trendingPostSchema = { 5 | root: { 6 | type: Number, 7 | required: true, 8 | }, 9 | title: { 10 | type: String, 11 | required: true, 12 | }, 13 | poster: { 14 | type: String, 15 | required: true, 16 | }, 17 | link: { 18 | type: String, 19 | required: true, 20 | }, 21 | } 22 | 23 | const TrendingPost = mongoose.model("TrendingPost", trendingPostSchema); 24 | 25 | module.exports = TrendingPost; 26 | -------------------------------------------------------------------------------- /backend/models/user.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Sessions = require('./sessionSchema'); 3 | 4 | // User Database Model 5 | const userSchema = { 6 | name: { 7 | type: String, 8 | required: true 9 | }, 10 | email: { 11 | type: String, 12 | lowercase: true, 13 | required: true, 14 | unique: true 15 | }, 16 | avatar: { 17 | type: String, 18 | lowercase: true, 19 | }, 20 | registeredDate: { 21 | type: Number, 22 | required: true, 23 | default: Date.now, 24 | }, 25 | password: { 26 | type: String, 27 | default: null 28 | }, 29 | temppassword: { 30 | type: String 31 | }, 32 | temprestricted: { 33 | type: Boolean, 34 | default: false 35 | }, 36 | role: { 37 | type: String, 38 | required: true, 39 | default: 'user' 40 | }, 41 | sessions: [Sessions], 42 | admin: { 43 | type: Boolean, 44 | required: true, 45 | default: false 46 | }, 47 | superadmin: { 48 | type: Boolean, 49 | required: true, 50 | default: false 51 | }, 52 | verified: { 53 | type: Boolean, 54 | required: true, 55 | default: false 56 | }, 57 | }; 58 | 59 | const User = mongoose.model("User", userSchema); 60 | 61 | module.exports = User; 62 | -------------------------------------------------------------------------------- /backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "g-index-backend", 3 | "version": "2.2.5", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "start": "set NODE_ENV=production && node app", 8 | "develop": "set NODE_ENV=development && nodemon app.js", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "axios": "^0.19.2", 15 | "bcrypt": "^5.0.0", 16 | "body-parser": "^1.19.0", 17 | "cors": "^2.8.5", 18 | "dotenv": "^8.2.0", 19 | "ejs": "^3.1.3", 20 | "express": "^4.17.1", 21 | "jsonwebtoken": "^8.5.1", 22 | "mongoose": "^5.9.25", 23 | "nodemailer": "^6.4.11", 24 | "nodemon": "^2.0.4", 25 | "ping": "^0.2.3", 26 | "randomstring": "^1.1.5", 27 | "sqlite3": "^4.2.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-one/index.js: -------------------------------------------------------------------------------- 1 | const Parser = require("./src/parser").Parser; 2 | const handlers = require("./src/handlers"); 3 | 4 | const defaultParser = new Parser(); 5 | 6 | handlers.addDefaults(defaultParser); 7 | 8 | exports.addDefaults = handlers.addDefaults; 9 | exports.addHandler = (handlerName, handler, options) => defaultParser.addHandler(handlerName, handler, options); 10 | exports.parse = title => defaultParser.parse(title); 11 | exports.Parser = Parser; 12 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-one/src/parser.js: -------------------------------------------------------------------------------- 1 | function extendOptions(options) { 2 | options = options || {}; 3 | 4 | const defaultOptions = { 5 | skipIfAlreadyFound: true, 6 | type: "string", 7 | }; 8 | 9 | options.skipIfAlreadyFound = options.skipIfAlreadyFound || defaultOptions.skipIfAlreadyFound; 10 | options.type = options.type || defaultOptions.type; 11 | 12 | return options; 13 | } 14 | 15 | function createHandlerFromRegExp(name, regExp, options) { 16 | let transformer; 17 | 18 | if (!options.type) { 19 | transformer = input => input; 20 | } else if (options.type.toLowerCase() === "lowercase") { 21 | transformer = input => input.toLowerCase(); 22 | } else if (options.type.toLowerCase().slice(0, 4) === "bool") { 23 | transformer = () => true; 24 | } else if (options.type.toLowerCase().slice(0, 3) === "int") { 25 | transformer = input => parseInt(input, 10); 26 | } else { 27 | transformer = input => input; 28 | } 29 | 30 | function handler({ title, result }) { 31 | if (result[name] && options.skipIfAlreadyFound) { 32 | return null; 33 | } 34 | 35 | const match = title.match(regExp); 36 | const [rawMatch, cleanMatch] = match || []; 37 | 38 | if (rawMatch) { 39 | result[name] = options.value || transformer(cleanMatch || rawMatch); 40 | return match.index; 41 | } 42 | 43 | return null; 44 | } 45 | 46 | handler.handlerName = name; 47 | 48 | return handler; 49 | } 50 | 51 | function cleanTitle(rawTitle) { 52 | let cleanedTitle = rawTitle; 53 | 54 | if (cleanedTitle.indexOf(" ") === -1 && cleanedTitle.indexOf(".") !== -1) { 55 | cleanedTitle = cleanedTitle.replace(/\./g, " "); 56 | } 57 | 58 | cleanedTitle = cleanedTitle.replace(/_/g, " "); 59 | cleanedTitle = cleanedTitle.replace(/([(_]|- )$/, "").trim(); 60 | 61 | return cleanedTitle; 62 | } 63 | 64 | class Parser { 65 | 66 | constructor() { 67 | this.handlers = []; 68 | } 69 | 70 | addHandler(handlerName, handler, options) { 71 | if (typeof handler === "undefined" && typeof handlerName === "function") { 72 | 73 | // If no name is provided and a function handler is directly given 74 | handler = handlerName; 75 | handler.handlerName = "unknown"; 76 | 77 | } else if (typeof handlerName === "string" && handler instanceof RegExp) { 78 | 79 | // If the handler provided is a regular expression 80 | options = extendOptions(options); 81 | handler = createHandlerFromRegExp(handlerName, handler, options); 82 | 83 | } else if (typeof handler === "function") { 84 | 85 | // If the handler is a function 86 | handler.handlerName = handlerName; 87 | 88 | } else { 89 | 90 | // If the handler is neither a function nor a regular expression, throw an error 91 | throw new Error(`Handler for ${handlerName} should be a RegExp or a function. Got: ${typeof handler}`); 92 | 93 | } 94 | 95 | this.handlers.push(handler); 96 | } 97 | 98 | parse(title) { 99 | const result = {}; 100 | let endOfTitle = title.length; 101 | 102 | for (const handler of this.handlers) { 103 | const matchIndex = handler({ title, result }); 104 | 105 | if (matchIndex && matchIndex < endOfTitle) { 106 | endOfTitle = matchIndex; 107 | } 108 | } 109 | 110 | result.title = cleanTitle(title.slice(0, endOfTitle)); 111 | 112 | return result; 113 | } 114 | } 115 | 116 | exports.Parser = Parser; 117 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-two/core.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var EventEmitter = require('events').EventEmitter; 4 | 5 | var Core = function() { 6 | EventEmitter.call(this); 7 | 8 | var parts; 9 | 10 | this.getParts = function() { 11 | return parts; 12 | }; 13 | 14 | this.on('setup', function () { 15 | parts = {}; 16 | }); 17 | 18 | this.on('part', function (part) { 19 | parts[part.name] = part.clean; 20 | }); 21 | }; 22 | 23 | Core.prototype = Object.create(EventEmitter.prototype); 24 | Core.prototype.constructor = EventEmitter; 25 | 26 | Core.prototype.exec = function(name) { 27 | this.emit('setup', { 28 | name: name 29 | }); 30 | this.emit('start'); 31 | this.emit('end'); 32 | 33 | return this.getParts(); 34 | }; 35 | 36 | module.exports = new Core(); 37 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-two/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./parts/common'); 4 | require('./parts/title'); 5 | require('./parts/excess'); 6 | 7 | module.exports = function(name) { 8 | return require('./core').exec(name); 9 | }; 10 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-two/parts/common.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var core = require('../core'); 4 | 5 | /** 6 | * Pattern should contain either none or two capturing groups. 7 | * In case of two groups - 1st is raw, 2nd is clean. 8 | */ 9 | var patterns = { 10 | season: /([Ss]?([0-9]{1,2}))[Eex]/, 11 | episode: /([Eex]([0-9]{2})(?:[^0-9]|$))/, 12 | year: /([\[\(]?((?:19[0-9]|20[01])[0-9])[\]\)]?)/, 13 | resolution: /(([0-9]{3,4}p))[^M]/, 14 | quality: /(?:PPV\.)?[HP]DTV|(?:HD)?CAM|B[rR]Rip|TS|(?:PPV )?WEB-?DL(?: DVDRip)?|H[dD]Rip|DVDRip|DVDRiP|DVDRIP|CamRip|W[EB]B[rR]ip|[Bb]lu[Rr]ay|DvDScr|hdtv/, 15 | codec: /xvid|x264|h\.?264/i, 16 | audio: /MP3|DD5\.?1|Dual[\- ]Audio|LiNE|DTS|AAC(?:\.?2\.0)?|AC3(?:\.5\.1)?/, 17 | group: /(- ?([^-]+(?:-={[^-]+-?$)?))$/, 18 | region: /R[0-9]/, 19 | extended: /EXTENDED/, 20 | hardcoded: /HC/, 21 | proper: /PROPER/, 22 | repack: /REPACK/, 23 | container: /MKV|AVI/, 24 | widescreen: /WS/, 25 | website: /^(\[ ?([^\]]+?) ?\])/, 26 | language: /rus\.eng/, 27 | garbage: /1400Mb|3rd Nov| ((Rip))/ 28 | }; 29 | var types = { 30 | season: 'integer', 31 | episode: 'integer', 32 | year: 'integer', 33 | extended: 'boolean', 34 | hardcoded: 'boolean', 35 | proper: 'boolean', 36 | repack: 'boolean', 37 | widescreen: 'boolean' 38 | }; 39 | var torrent; 40 | 41 | core.on('setup', function (data) { 42 | torrent = data; 43 | }); 44 | 45 | core.on('start', function() { 46 | var key, match, index, clean, part; 47 | 48 | for(key in patterns) { 49 | if(patterns.hasOwnProperty(key)) { 50 | if(!(match = torrent.name.match(patterns[key]))) { 51 | continue; 52 | } 53 | 54 | index = { 55 | raw: match[1] ? 1 : 0, 56 | clean: match[1] ? 2 : 0 57 | }; 58 | 59 | if(types[key] && types[key] === 'boolean') { 60 | clean = true; 61 | } 62 | else { 63 | clean = match[index.clean]; 64 | 65 | if(types[key] && types[key] === 'integer') { 66 | clean = parseInt(clean, 10); 67 | } 68 | } 69 | 70 | if(key === 'group') { 71 | if(clean.match(patterns.codec) || clean.match(patterns.quality)) { 72 | continue; 73 | } 74 | 75 | if(clean.match(/[^ ]+ [^ ]+ .+/)) { 76 | key = 'episodeName'; 77 | } 78 | } 79 | 80 | part = { 81 | name: key, 82 | match: match, 83 | raw: match[index.raw], 84 | clean: clean 85 | }; 86 | 87 | if(key === 'episode') { 88 | core.emit('map', torrent.name.replace(part.raw, '{episode}')); 89 | } 90 | 91 | core.emit('part', part); 92 | } 93 | } 94 | 95 | core.emit('common'); 96 | }); 97 | 98 | core.on('late', function (part) { 99 | if(part.name === 'group') { 100 | core.emit('part', part); 101 | } 102 | else if(part.name === 'episodeName') { 103 | part.clean = part.clean.replace(/[\._]/g, ' '); 104 | part.clean = part.clean.replace(/_+$/, '').trim(); 105 | core.emit('part', part); 106 | } 107 | }); 108 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-two/parts/excess.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var core = require('../core'); 4 | 5 | var torrent, raw, groupRaw; 6 | var escapeRegex = function(string) { 7 | return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); 8 | }; 9 | 10 | core.on('setup', function (data) { 11 | torrent = data; 12 | raw = torrent.name; 13 | groupRaw = ''; 14 | }); 15 | 16 | core.on('part', function (part) { 17 | if(part.name === 'excess') { 18 | return; 19 | } 20 | else if(part.name === 'group') { 21 | groupRaw = part.raw; 22 | } 23 | 24 | // remove known parts from the excess 25 | raw = raw.replace(part.raw, ''); 26 | }); 27 | 28 | core.on('map', function (map) { 29 | torrent.map = map; 30 | }); 31 | 32 | core.on('end', function () { 33 | var clean, groupPattern, episodeNamePattern; 34 | 35 | // clean up excess 36 | clean = raw.replace(/(^[-\. ]+)|([-\. ]+$)/g, ''); 37 | clean = clean.replace(/[\(\)\/]/g, ' '); 38 | clean = clean.split(/\.\.+| +/).filter(Boolean); 39 | 40 | if(clean.length !== 0) { 41 | groupPattern = escapeRegex(clean[clean.length - 1] + groupRaw) + '$'; 42 | 43 | if(torrent.name.match(new RegExp(groupPattern))) { 44 | core.emit('late', { 45 | name: 'group', 46 | clean: clean.pop() + groupRaw 47 | }); 48 | } 49 | 50 | if(torrent.map && clean[0]) { 51 | episodeNamePattern = '{episode}' + escapeRegex(clean[0].replace(/_+$/, '')); 52 | 53 | if(torrent.map.match(new RegExp(episodeNamePattern))) { 54 | core.emit('late', { 55 | name: 'episodeName', 56 | clean: clean.shift() 57 | }); 58 | } 59 | } 60 | } 61 | 62 | if(clean.length !== 0) { 63 | core.emit('part', { 64 | name: 'excess', 65 | raw: raw, 66 | clean: clean.length === 1 ? clean[0] : clean 67 | }); 68 | } 69 | }); 70 | -------------------------------------------------------------------------------- /backend/parsers/torrent-name-parser-two/parts/title.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var core = require('../core'); 4 | 5 | require('./common'); 6 | 7 | var torrent, start, end, raw; 8 | 9 | core.on('setup', function (data) { 10 | torrent = data; 11 | start = 0; 12 | end = undefined; 13 | raw = undefined; 14 | }); 15 | 16 | core.on('part', function (part) { 17 | if(!part.match) { 18 | return; 19 | } 20 | 21 | if(part.match.index === 0) { 22 | start = part.match[0].length; 23 | 24 | return; 25 | } 26 | 27 | if(!end || part.match.index < end) { 28 | end = part.match.index; 29 | } 30 | }); 31 | 32 | core.on('common', function () { 33 | var raw = end ? torrent.name.substr(start, end - start).split('(')[0] : torrent.name; 34 | var clean = raw; 35 | 36 | // clean up title 37 | clean = raw.replace(/^ -/, ''); 38 | 39 | if(clean.indexOf(' ') === -1 && clean.indexOf('.') !== -1) { 40 | clean = clean.replace(/\./g, ' '); 41 | } 42 | 43 | clean = clean.replace(/_/g, ' '); 44 | clean = clean.replace(/([\(_]|- )$/, '').trim(); 45 | 46 | core.emit('part', { 47 | name: 'title', 48 | raw: raw, 49 | clean: clean 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /backend/plugins/checkOrigin.js: -------------------------------------------------------------------------------- 1 | module.exports = function (origin){ 2 | var allowedOrigins = process.env.FRONTENDURL.split(","); 3 | if (origin && allowedOrigins.indexOf(origin) > -1){ 4 | return true 5 | } else { 6 | return false 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /backend/plugins/deleteAll.js: -------------------------------------------------------------------------------- 1 | const deleteUsers = require('./deleteUsers'); 2 | const deletePendingUsers = require('./deletePendingUsers'); 3 | const deleteInvitedUsers = require('./deleteInvitedUsers'); 4 | 5 | function deleteAll() { 6 | setInterval(async () => { 7 | await deleteUsers(); 8 | await deletePendingUsers(); 9 | await deleteInvitedUsers(); 10 | }, (7200 * 1000)) 11 | } 12 | 13 | module.exports = deleteAll; 14 | -------------------------------------------------------------------------------- /backend/plugins/deleteInvitedUsers.js: -------------------------------------------------------------------------------- 1 | const transport = require('./mailtransporter'); 2 | const InvitedUser = require("../models/invitedUser"); 3 | const toInvitedUserEmail = require('../templates/delete/invitedUsers/toAll'); 4 | 5 | function deleteInvitedUsers() { 6 | console.log("Triggered Verification Check") 7 | InvitedUser.find({}, function(error, result){ 8 | if(result){ 9 | result.forEach((user, i) => { 10 | const currentTime = Date.now(); 11 | const allowedTill = user.pendingFrom + (86400*1000); 12 | if(currentTime > allowedTill){ 13 | InvitedUser.deleteOne({ email: user.email }, function(error){ 14 | if(!error){ 15 | const deleteMessage = { 16 | from: `"${process.env.FRONTENDSITENAME} - Support"<${process.env.EMAILID}>`, 17 | to: user.invitedby, 18 | replyTo: process.env.REPLYTOMAIL, 19 | subject: `Regarding Your Invite to ${user.email}`, 20 | html: toInvitedUserEmail(user), 21 | }; 22 | } else { 23 | console.log("Some Error While Trying to Deleting, Will be Deleted in Next Cycle.") 24 | } 25 | }) 26 | } else { 27 | console.log("You Got Some Time Left") 28 | } 29 | }); 30 | 31 | } else { 32 | console.log("No Invited Users") 33 | } 34 | }) 35 | } 36 | 37 | module.exports = deleteInvitedUsers; 38 | -------------------------------------------------------------------------------- /backend/plugins/deletePendingUsers.js: -------------------------------------------------------------------------------- 1 | const transport = require('./mailtransporter'); 2 | const PendingUser = require("../models/pendingUser"); 3 | const deletePendingUserTemplate = require('../templates/delete/pending/toAll'); 4 | 5 | function deletePendingUsers() { 6 | console.log("Triggered Verification Check") 7 | PendingUser.find({}, function(error, result){ 8 | if(result){ 9 | result.forEach((user, i) => { 10 | const currentTime = Date.now(); 11 | const allowedTill = user.pendingFrom + (86400*1000); 12 | if(currentTime > allowedTill){ 13 | PendingUser.deleteOne({ email: user.email }, function(error){ 14 | if(!error){ 15 | const deleteMessage = { 16 | from: `"${process.env.FRONTENDSITENAME} - Support"<${process.env.EMAILID}>`, 17 | to: user.email, 18 | replyTo: process.env.REPLYTOMAIL, 19 | subject: 'Regarding Your Request', 20 | html: deletePendingUserTemplate(user), 21 | }; 22 | transport.sendMail(deleteMessage, function(err, info){ 23 | if(err){ 24 | console.log(err); 25 | } else { 26 | console.log(info) 27 | } 28 | }) 29 | } else { 30 | console.log("Some Error While Trying to Deleting, Will be Deleted in Next Cycle.") 31 | } 32 | }) 33 | } else { 34 | console.log("You Got Some Time Left") 35 | } 36 | }); 37 | } else { 38 | console.log("No Pending Users") 39 | } 40 | }) 41 | } 42 | 43 | module.exports = deletePendingUsers 44 | -------------------------------------------------------------------------------- /backend/plugins/deleteUsers.js: -------------------------------------------------------------------------------- 1 | const transport = require('./mailtransporter'); 2 | const User = require("../models/user"); 3 | const nonVerfiedEmailTemplate = require('../templates/delete/users/toNonVerified.js'); 4 | 5 | function deleteTimeout() { 6 | console.log("Triggered Verification Check") 7 | User.find({ verified: false }, function(error, result){ 8 | if(result){ 9 | result.forEach((user, i) => { 10 | const currentDate = Date.now(); 11 | const expiryDate = user.registeredDate + (10800 * 1000); 12 | console.log(currentDate, expiryDate); 13 | if(currentDate > expiryDate){ 14 | User.deleteOne({ email: user.email }, function(error){ 15 | if(error){ 16 | console.log(error) 17 | } else { 18 | const deleteMessage = { 19 | from: `"${process.env.FRONTENDSITENAME} - Support"<${process.env.EMAILID}>`, 20 | to: user.email, 21 | replyTo: process.env.REPLYTOMAIL, 22 | subject: 'Deletion of Your Account.', 23 | html: nonVerfiedEmailTemplate(user), // Plain text body 24 | }; 25 | transport.sendMail(deleteMessage, function(err, info){ 26 | if(err){ 27 | console.log(err); 28 | } else { 29 | console.log(info) 30 | } 31 | }) 32 | } 33 | }) 34 | } else { 35 | console.log("You Got Time to Get Verified.") 36 | } 37 | }); 38 | } else { 39 | console.log("All Users are Verified.") 40 | } 41 | }) 42 | } 43 | 44 | module.exports = deleteTimeout; 45 | -------------------------------------------------------------------------------- /backend/plugins/jwtVerify.js: -------------------------------------------------------------------------------- 1 | const jwt = require("jsonwebtoken"); 2 | 3 | function verify(token){ 4 | if(token){ 5 | return jwt.verify(token, process.env.TOKENSECRET, function(error, decoded){ 6 | if(decoded){ 7 | return true 8 | } else { 9 | return false 10 | } 11 | }); 12 | } else { 13 | return false 14 | } 15 | } 16 | 17 | module.exports = verify 18 | -------------------------------------------------------------------------------- /backend/plugins/keepAlive.js: -------------------------------------------------------------------------------- 1 | // Keep Site Online By Pinging every 25 Minutes. 2 | const site = process.env.SITE; 3 | const axios = require('axios'); 4 | 5 | function keepalive() { 6 | if (site) { 7 | try { 8 | setInterval(async () => { 9 | const data = await axios.get(site); 10 | console.log(data.config.url, "status:"+''+ data.status , "Text:"+' '+data.statusText); 11 | }, 1560000); 12 | } catch(e) { 13 | console.log(e); 14 | } 15 | } else { 16 | console.warn("Set site env var"); 17 | } 18 | } 19 | 20 | module.exports = keepalive; 21 | -------------------------------------------------------------------------------- /backend/plugins/mailtransporter.js: -------------------------------------------------------------------------------- 1 | const nodemailer = require('nodemailer'); 2 | 3 | // Define Mail Transporter 4 | let transport = nodemailer.createTransport({ 5 | host: process.env.EMAILSMTP, 6 | port: process.env.EMAILPORT, 7 | service:process.env.EMAILSERVICE, 8 | auth: { 9 | user: process.env.EMAILID, 10 | pass: process.env.EMAILPASS 11 | } 12 | }); 13 | 14 | module.exports = transport; 15 | -------------------------------------------------------------------------------- /backend/public/css/styles.css: -------------------------------------------------------------------------------- 1 | .bd-placeholder-img { 2 | font-size: 1.125rem; 3 | text-anchor: middle; 4 | -webkit-user-select: none; 5 | -moz-user-select: none; 6 | -ms-user-select: none; 7 | user-select: none; 8 | } 9 | 10 | @media (min-width: 768px) { 11 | .bd-placeholder-img-lg { 12 | font-size: 3.5rem; 13 | } 14 | } 15 | 16 | .data { 17 | text-align: center; 18 | } 19 | 20 | .lead { 21 | font-weight: bold; 22 | } 23 | -------------------------------------------------------------------------------- /backend/routes/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const bcrypt = require('bcrypt'); 4 | 5 | //Model Imports 6 | const User = require("../models/user"); 7 | const PendingUser = require("../models/pendingUser"); 8 | const SpamUser = require("../models/spamUser"); 9 | const InvitedUser = require("../models/invitedUser"); 10 | const checkOrigin = require("../plugins/checkOrigin"); 11 | 12 | router.get('/', function(req, res){ 13 | User.findOne({ superadmin: true }, function(error, result){ 14 | if(result){ 15 | res.render("dashboard.ejs", { user: false, showPass: false, data: "This is a Backend for G-Index. This has Been Already Setup. So Nothing Exists Here Afterwards. Use Your Frontend to Communicate.", fronturl: process.env.FRONTENDURL.split(",")[0] }); 16 | } else { 17 | res.render("signup.ejs"); 18 | } 19 | }) 20 | }); 21 | 22 | router.get('/generate', function(req, res){ 23 | res.render("generate.ejs"); 24 | }); 25 | 26 | router.post('/generate', function(req, res){ 27 | bcrypt.hash(req.body.password, 10, function(err, hashedPass){ 28 | if(hashedPass){ 29 | res.render("dashboard.ejs", {user: false, showPass: true, hybrid: hashedPass}) 30 | } 31 | }) 32 | }); 33 | 34 | router.post('/checkmail', function(req, res){ 35 | if(checkOrigin(req.headers.origin)){ 36 | SpamUser.findOne({ email: req.body.email }, function(err, result){ 37 | if(result){ 38 | res.status(200).send({ auth: false, user: false, status: "Spammed User" }) 39 | } else { 40 | PendingUser.findOne({ email: req.body.email }, function(err ,result){ 41 | if(result){ 42 | res.status(200).send({ auth: false, user: false, status: "Pending Confirmation from Admins." }) 43 | } else { 44 | User.findOne({ email: req.body.email }, function(err, result){ 45 | if(result){ 46 | if(result.verified){ 47 | res.status(200).send({ auth: true, user: true, status: "User Present & Verified" }) 48 | } else { 49 | res.status(200).send({ auth: false, user:true, status: "User Present & Not Verified" }) 50 | } 51 | } else { 52 | res.status(200).send({ auth: false, user: false, status: "User Not Present" }) 53 | } 54 | }) 55 | } 56 | }) 57 | } 58 | }) 59 | } else { 60 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 61 | } 62 | }) 63 | 64 | module.exports = router; 65 | -------------------------------------------------------------------------------- /backend/routes/pending/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const checkOrigin = require("../../plugins/checkOrigin"); 4 | const jwtVerify = require('../../plugins/jwtVerify'); 5 | 6 | //Model Imports 7 | const User = require("../../models/user"); 8 | const PendingUser = require("../../models/pendingUser"); 9 | 10 | router.post('/users', function(req, res){ 11 | if(checkOrigin(req.headers.origin)){ 12 | if(jwtVerify(req.headers.token)){ 13 | User.findOne({ email: req.body.adminuseremail }, function(error, result){ 14 | if(result){ 15 | if(result.admin){ 16 | PendingUser.find({ post: "User" }, function(error, result){ 17 | if(result.length == 0){ 18 | res.status(200).send({ auth: false, registered: true, message: "No Pending Users" }) 19 | } else { 20 | res.status(200).send({ auth: true, registered: true, users: result }) 21 | } 22 | }) 23 | } else { 24 | res.status(200).send({ auth: false, registered: true, message: "You are Unauthorized" }) 25 | } 26 | } else { 27 | res.status(200).send({ auth: false, registered: false, message: "BAD REQUEST" }) 28 | } 29 | }) 30 | } else { 31 | res.status(200).send({ auth: false, message: "Bearer Token Not Valid" }) 32 | } 33 | } else { 34 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 35 | } 36 | }); 37 | 38 | router.post('/admins', function(req, res){ 39 | if(checkOrigin(req.headers.origin)){ 40 | if(jwtVerify(req.headers.token)){ 41 | User.findOne({ email: req.body.adminuseremail }, function(error, result){ 42 | if(result){ 43 | if(result.admin){ 44 | if(result.superadmin){ 45 | PendingUser.find({ post: "Admin" }, function(error, result){ 46 | if(result.length == 0){ 47 | res.status(200).send({ auth: false, registered: true, message: "No Pending Users" }) 48 | } else { 49 | res.status(200).send({ auth: true, registered: true, users: result }) 50 | } 51 | }) 52 | } else { 53 | res.status(200).send({ auth: false, registered: true, message: "You are Unauthorized" }) 54 | } 55 | } else { 56 | res.status(200).send({ auth: false, registered: true, message: "You are Unauthorized" }) 57 | } 58 | } else { 59 | res.status(200).send({ auth: false, registered: false, message: "BAD REQUEST" }) 60 | } 61 | }) 62 | } else { 63 | res.status(200).send({ auth: false, message: "Bearer Token Not Valid" }) 64 | } 65 | } else { 66 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 67 | } 68 | }) 69 | 70 | router.post('/superadmins', function(req, res){ 71 | if(checkOrigin(req.headers.origin)){ 72 | if(jwtVerify(req.headers.token)){ 73 | User.findOne({ email: req.body.adminuseremail }, function(error, result){ 74 | if(result){ 75 | if(result.admin){ 76 | if(result.superadmin){ 77 | PendingUser.find({ post: "SuperAdmin" }, function(error, result){ 78 | if(result.length == 0){ 79 | res.status(200).send({ auth: false, registered: true, message: "No Pending Users" }) 80 | } else { 81 | res.status(200).send({ auth: true, registered: true, users: result }) 82 | } 83 | }) 84 | } else { 85 | res.status(200).send({ auth: false, registered: true, message: "You are Unauthorized" }) 86 | } 87 | } else { 88 | res.status(200).send({ auth: false, registered: true, message: "You are Unauthorized" }) 89 | } 90 | } else { 91 | res.status(200).send({ auth: false, registered: false, message: "BAD REQUEST" }) 92 | } 93 | }) 94 | } else { 95 | res.status(200).send({ auth: false, message: "Bearer Token Not Valid" }) 96 | } 97 | } else { 98 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 99 | } 100 | }) 101 | 102 | module.exports = router; 103 | -------------------------------------------------------------------------------- /backend/routes/ping.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | var ping = require('ping'); 4 | 5 | router.post('/', async function(req, res){ 6 | let pinged = await ping.promise.probe(req.body.pingsite, { 7 | timeout: 10, 8 | }); 9 | res.send(pinged); 10 | }) 11 | 12 | module.exports = router; 13 | -------------------------------------------------------------------------------- /backend/routes/poster.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const checkOrigin = require("../plugins/checkOrigin"); 4 | const jwtVerify = require('../plugins/jwtVerify'); 5 | 6 | //Model Imports 7 | const User = require("../models/user"); 8 | const CategoryPost = require("../models/categoryPost"); 9 | const HeroPost = require("../models/heroPost"); 10 | const TrendingPost = require("../models/trendingPost"); 11 | const QuickLink = require("../models/quickLink"); 12 | 13 | router.post("/all", function(req, res){ 14 | if(checkOrigin(req.headers.origin)){ 15 | if(jwtVerify(req.headers.token)){ 16 | User.findOne({ email: req.body.email }, function(error, result){ 17 | if(result){ 18 | TrendingPost.find({ root: req.body.root }, function(error, trendingPosts){ 19 | HeroPost.find({ root: req.body.root }, function(error, heroPosts){ 20 | CategoryPost.find({ root: req.body.root }, function(error, categoryPosts){ 21 | QuickLink.find({ root: req.body.root }, function(error, quicklinks){ 22 | if(quicklinks && trendingPosts.length < 1 && heroPosts.length < 1 && categoryPosts.length < 1){ 23 | res.status(200).send({ auth: false, registered: true, message: "No Posts Found in Your DB" }); 24 | } else { 25 | res.status(200).send({ auth: true, registered: true, root: req.body.root, quicklink: quicklinks, hero: heroPosts, category: categoryPosts, trending: trendingPosts }); 26 | } 27 | }) 28 | }) 29 | }) 30 | }) 31 | } else { 32 | res.status(200).send({ auth: false, registered: false, message: "BAD REQUEST" }); 33 | } 34 | }) 35 | } else { 36 | res.status(200).send({ auth: false, message: "Bearer Token Not Valid" }) 37 | } 38 | } else { 39 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 40 | } 41 | }) 42 | 43 | router.use("/categories", require("./posters/categories")); 44 | router.use("/hero", require("./posters/hero")); 45 | router.use("/trending", require("./posters/trending")); 46 | router.use("/quicklinks", require("./posters/quicklinks")); 47 | 48 | module.exports = router 49 | -------------------------------------------------------------------------------- /backend/routes/settings.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const checkOrigin = require("../plugins/checkOrigin"); 4 | const jwtVerify = require('../plugins/jwtVerify'); 5 | 6 | //Model Imports 7 | const User = require("../models/user"); 8 | const Settings = require("../models/siteSettings"); 9 | 10 | router.post('/set', function(req, res){ 11 | if(checkOrigin(req.headers.origin)){ 12 | if(jwtVerify(req.headers.token)){ 13 | User.findOne({ email: req.body.email }, function(error, result){ 14 | if(result){ 15 | if(result.admin && result.superadmin){ 16 | Settings.findOne({ cId: process.env.FRONTENDSITENAME }, function(error, settingsData){ 17 | if(settingsData){ 18 | Settings.updateOne({ cId: process.env.FRONTENDSITENAME }, { $set: req.body.settings }, function(error){ 19 | if(!error){ 20 | res.status(200).send({ auth: true, registered: true, changed: true, message: "Your Preferences have been Saved." }); 21 | } else { 22 | res.status(200).send({ auth: true, registered: true, changed: false, message: "Error Occured while Saving Your Preferences" }); 23 | } 24 | }) 25 | } else { 26 | const newData = new Settings(req.body.settings); 27 | newData.save(function(error, doc){ 28 | if(!error){ 29 | res.status(200).send({ auth: true, registered: true, changed: true, data: doc, message: "Your Preferences have been Saved." }); 30 | } 31 | }) 32 | } 33 | }) 34 | } else { 35 | res.status(200).send({ auth: false, registered: true, changed: false, message: "You don't Have Enough Permissions." }) 36 | } 37 | } else { 38 | res.status(200).send({ auth: false, registered: false, changed: false, message: "Account Doesn't Exists" }) 39 | } 40 | }) 41 | } else { 42 | res.status(200).send({ auth: false, message: "Bearer Token Not Valid" }) 43 | } 44 | } else { 45 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 46 | } 47 | }) 48 | 49 | router.post("/get", function(req, res){ 50 | if(checkOrigin(req.headers.origin)){ 51 | Settings.findOne({ cId: process.env.FRONTENDSITENAME }, function(error, result){ 52 | if(result){ 53 | res.status(200).send({ auth: true, registered: true, data: result }); 54 | } else { 55 | res.status(200).send({ auth: false, registered: true, message: "There's an Error while Getting Site Details." }); 56 | } 57 | }) 58 | } else { 59 | res.status(200).send({ auth: false, message: "UNAUTHORIZED" }) 60 | } 61 | }) 62 | 63 | module.exports = router; 64 | -------------------------------------------------------------------------------- /backend/views/dashboard.ejs: -------------------------------------------------------------------------------- 1 | <%- include("header") -%> 2 | 3 | 4 | <% if(user){ %> 5 |
6 |
7 |

Your Details

8 |

9 | Your Name is <%= details.name %> 10 |

11 |

12 | Your Email is <%= details.email %> 13 |

14 |

This Page is Only Visible Only for One Time

15 |

Hereafter You Can Login to Frontend With this Email and Password.Login

16 |

To setup the Frontend, Please Continue with this Wiki

17 |
18 |
19 | <% } else if(!showPass) { %> 20 |
21 |
22 |

23 | <%= data %> 24 |

25 |

26 | Generate a Hybrid Password 27 |

28 |

Go to Frontend

29 |
30 |
31 | <% } else {%> 32 |
33 |
34 |

35 | Your Hashed Hybrid Password 36 |

37 |

38 | <%= hybrid %> 39 |

40 |

Copy the Above and Paste in Your Worker File

41 |

Generate Another

42 |

Go to Home

43 |
44 |
45 | <% } %> 46 | <%- include("footer") -%> 47 | -------------------------------------------------------------------------------- /backend/views/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /backend/views/generate.ejs: -------------------------------------------------------------------------------- 1 | <%- include("header") -%> 2 | 3 |
4 |

Generate Hybrid Password

5 | 6 | 7 | 8 |

© G-Index Backend

9 |
10 | 11 | <%- include("footer") -%> 12 | -------------------------------------------------------------------------------- /backend/views/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | G-Index Backend 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /backend/views/signup.ejs: -------------------------------------------------------------------------------- 1 | <%- include("header") -%> 2 | 3 |
4 |

Add Root User to Database

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

© G-Index Backend

15 |
16 | 17 | <%- include("footer") -%> 18 | -------------------------------------------------------------------------------- /cli-tool/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .npmrc 3 | .npmrcs 4 | -------------------------------------------------------------------------------- /cli-tool/commands/configure/env/checkHerokuLogin.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async () => { 4 | try { 5 | const result = await execa('heroku', ['auth:token']); 6 | const tokenRegex = /(Warning: token will expire).+/; 7 | if(tokenRegex.test(result.stderr)){ 8 | return { 9 | res: true, 10 | output: result.stdout+'\n'+result.stderr, 11 | cmd: result.command, 12 | exitCode: result.exitCode 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stdout+'\n'+result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode 20 | }; 21 | } 22 | } catch(e) { 23 | return { 24 | res: false, 25 | output: e.stdout+'\n'+e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/configure/env/index.js: -------------------------------------------------------------------------------- 1 | const checkHerokuLogin = require('./checkHerokuLogin'); 2 | const pushConfigKeys = require('./pushConfigKeys'); 3 | const herokuNotAuthMess = require('../../init/post-init'); 4 | const inputPrompts = require('./inputPrompts'); 5 | const spinner = require('../../../helpers/spinner'); 6 | 7 | const chalk = require('chalk'); 8 | 9 | module.exports = async () => { 10 | spinner(true, 'Check for Heroku Login Status', 0, false, async(herokuSpin) => { 11 | const checkHeroku = await checkHerokuLogin(); 12 | herokuSpin.stop(); 13 | if(checkHeroku.res){ 14 | console.log( 15 | '\n'+ 16 | chalk.bold.green("Heroku Login Successfull")+'\n\n'+ 17 | chalk.white(checkHeroku.output)+ 18 | '\n' 19 | ); 20 | const appname = await inputPrompts.appName(); 21 | console.log(appname); 22 | if(appname.length > 1){ 23 | const envName = await inputPrompts.getEnvName(); 24 | if(envName.length > 1){ 25 | const envValue = await inputPrompts.envValue(envName); 26 | spinner(true, 'Pushing the Config Keys to Backend/Heroku', 0, false, async(configSpin) => { 27 | const pushConfigObj = await pushConfigKeys(appname, { 28 | envName: envName, 29 | envVal: envValue 30 | }); 31 | configSpin.stop(); 32 | if(pushConfigObj.res){ 33 | console.log( 34 | '\n'+ 35 | chalk.bold.green("Config Keys are Successfully Set. wait for 2 mins for the Build Process to Finish.")+'\n\n'+ 36 | chalk.white(pushConfigObj.output)+'\n\n'+ 37 | chalk.yellow.bold(`You can Access the backend in the following Address for Creating the Super User\n>> https://${appname}.herokuapp.com`)+ 38 | '\n' 39 | ); 40 | process.exit(); 41 | } else { 42 | console.log( 43 | '\n'+ 44 | chalk.bold.red("Config Keys are Not Successfully Set with the Following Error")+'\n\n'+ 45 | chalk.white(pushConfigObj.output)+ 46 | '\n' 47 | ); 48 | process.exit(); 49 | } 50 | }) 51 | } else { 52 | console.log( 53 | '\n'+ 54 | chalk.bold.red("Select appropriate ENV Name")+'\n' 55 | ); 56 | process.exit(); 57 | } 58 | } else { 59 | console.log( 60 | '\n'+ 61 | chalk.bold.red("Appname Should be More than Atleast 1 Chars")+'\n' 62 | ); 63 | process.exit(); 64 | } 65 | } else { 66 | console.log( 67 | '\n'+ 68 | chalk.bold.red("It Looks like You are not Logged in to Heroku")+'\n\n'+ 69 | chalk.white(checkHeroku.output)+ 70 | '\n'+ 71 | herokuNotAuthMess 72 | ); 73 | process.exit(); 74 | } 75 | }) 76 | 77 | } 78 | -------------------------------------------------------------------------------- /cli-tool/commands/configure/env/pushConfigKeys.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async (appname, configObj) => { 4 | try { 5 | const result = await execa(`heroku`,[`config:set`,`-a`,appname,`${configObj.envName}=${configObj.envVal}`,]); 6 | if(!result.failed && !result.killed && !result.timedOut && !result.isCancelled){ 7 | return { 8 | res: true, 9 | output: result.stdout+'\n'+result.stderr, 10 | cmd: result.command, 11 | exitCode: result.exitCode 12 | }; 13 | } else { 14 | return { 15 | res: false, 16 | output: result.stdout+'\n'+result.stderr, 17 | cmd: result.command, 18 | exitCode: result.exitCode 19 | }; 20 | } 21 | } catch(e) { 22 | return { 23 | res: false, 24 | output: e.stdout+'\n'+e.stderr, 25 | cmd: e.command, 26 | exitCode: e.exitCode 27 | }; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cli-tool/commands/configure/index.js: -------------------------------------------------------------------------------- 1 | exports.env = require("./env"); 2 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/checkHerokuLogin.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async () => { 4 | try { 5 | const result = await execa('heroku', ['auth:token']); 6 | const tokenRegex = /(Warning: token will expire).+/; 7 | if(tokenRegex.test(result.stderr)){ 8 | return { 9 | res: true, 10 | output: result.stdout+'\n'+result.stderr, 11 | cmd: result.command, 12 | exitCode: result.exitCode 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stdout+'\n'+result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode 20 | }; 21 | } 22 | } catch(e) { 23 | return { 24 | res: false, 25 | output: e.stdout+'\n'+e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/checkHerokuPresent.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async () => { 4 | try { 5 | const result = await execa('heroku', ['--version']); 6 | const tokenRegex = /(heroku\/).+/; 7 | if (tokenRegex.test(result.stdout)) { 8 | return { 9 | res: true, 10 | output: result.stdout + '\n' + result.stderr, 11 | cmd: result.command, 12 | exitCode: result.exitCode, 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stdout + '\n' + result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode, 20 | }; 21 | } 22 | } catch (e) { 23 | return { 24 | res: false, 25 | output: e.stdout + '\n' + e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode, 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/createHerokuApp.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async (appname) => { 4 | try { 5 | const result = await execa('heroku', ['create', appname]); 6 | const tokenRegex = new RegExp('Creating '+appname+'... done'); 7 | if(tokenRegex.test(result.stderr)){ 8 | return { 9 | res: true, 10 | output: result.stdout+'\n'+result.stderr, 11 | cmd: result.command, 12 | exitCode: result.exitCode 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stdout+'\n'+result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode 20 | }; 21 | } 22 | } catch(e) { 23 | return { 24 | res: false, 25 | output: e.stdout+'\n'+e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/createTMP.js: -------------------------------------------------------------------------------- 1 | const tmp = require('tmp'); 2 | const path = require('path'); 3 | 4 | module.exports = (exFunc) => { 5 | try { 6 | return tmp.dir({ template: 'gindex-cli-XXXXXX' },async function _tempDirCreated(err, tmppath, cleanupCallback) { 7 | if (err) throw err; 8 | const resPath = await path.join(tmppath, 'backend'); 9 | await exFunc(tmppath, resPath); 10 | }); 11 | } catch(e) { 12 | console.log(e); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/downloadUnzip.js: -------------------------------------------------------------------------------- 1 | const unzipper = require('unzipper'); 2 | const fs = require('fs'); 3 | const axios = require('axios'); 4 | const release = require('./getReleases'); 5 | 6 | module.exports = async (path, exfunc) => { 7 | let latVerUrl = await release(); 8 | return axios({ 9 | method: "get", 10 | url: `https://github.com/tks18/gindex-v4/releases/download/${latVerUrl.tag_name}/${latVerUrl.assets[0].name}`, 11 | responseType: "stream" 12 | }).then(resp => { 13 | resp.data.pipe(fs.createWriteStream(path+"/latest.zip").on('finish', () => { 14 | fs.createReadStream(path+"/latest.zip").pipe(unzipper.Extract({ path: path+'/backend' })).on('close', ()=> { 15 | exfunc(); 16 | }); 17 | })); 18 | }).catch(e => { 19 | return { 20 | res: false, 21 | output: e 22 | } 23 | }) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/getReleases.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const backendRegex = /^(backend).+/; 3 | 4 | module.exports = () => { 5 | return axios 6 | .get('https://api.github.com/repos/tks18/gindex-v4/releases') 7 | .then((resp) => { 8 | const result = resp.data.filter((releases) => { 9 | return backendRegex.test(releases.tag_name) && !releases.prerelease; 10 | })[0]; 11 | return result; 12 | }); 13 | }; 14 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/gitCheckoutHApp.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (appname, cwdPath) => { 5 | let resPath = path.resolve(cwdPath); 6 | try { 7 | const result = await execa('heroku', ['git:remote','-a', appname], { cwd: resPath }); 8 | if(!result.failed && !result.killed && !result.timedOut && !result.isCancelled){ 9 | return { 10 | res: true, 11 | output: result.stdout+'\n'+result.stderr, 12 | cmd: result.command, 13 | exitCode: result.exitCode 14 | }; 15 | } else { 16 | return { 17 | res: false, 18 | output: result.stdout+'\n'+result.stderr, 19 | cmd: result.command, 20 | exitCode: result.exitCode 21 | }; 22 | } 23 | } catch(e) { 24 | return { 25 | res: false, 26 | output: e.stdout+'\n'+e.stderr, 27 | cmd: e.command, 28 | exitCode: e.exitCode 29 | }; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/gitPushHeroku.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (cwdPath) => { 5 | const backPath = path.resolve(cwdPath); 6 | try { 7 | const result = await execa('git', ['push','heroku', 'master'], { cwd: backPath }); 8 | if(!result.failed && !result.killed && !result.timedOut && !result.isCancelled){ 9 | return { 10 | res: true, 11 | output: result.stdout+'\n'+result.stderr, 12 | cmd: result.command, 13 | exitCode: result.exitCode 14 | }; 15 | } else { 16 | return { 17 | res: false, 18 | output: result.stdout+'\n'+result.stderr, 19 | cmd: result.command, 20 | exitCode: result.exitCode 21 | }; 22 | } 23 | } catch(e) { 24 | return { 25 | res: false, 26 | output: e.stdout+'\n'+e.stderr, 27 | cmd: e.command, 28 | exitCode: e.exitCode 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/initBackendnCommit.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (backPath) => { 5 | try { 6 | let cwdPath = path.normalize(path.resolve(backPath)); 7 | const gitInit = await execa('git', ['init'], {cwd: cwdPath}); 8 | if(!gitInit.failed && !gitInit.killed && !gitInit.timedOut && !gitInit.isCancelled){ 9 | const gitAdd = await execa('git', ['add', '.'], {cwd: cwdPath}); 10 | if(!gitAdd.failed && !gitAdd.killed && !gitAdd.timedOut && !gitAdd.isCancelled){ 11 | const gitCommit = await execa('git', ['commit', '-m', '%Automated Bot Commit%'],{cwd: cwdPath}); 12 | if(!gitCommit.failed && !gitCommit.killed && !gitCommit.timedOut && !gitCommit.isCancelled){ 13 | return { 14 | res: true, 15 | initOut: gitInit.stdout, 16 | addOut: gitAdd.stdout, 17 | commitOut: gitCommit.stdout, 18 | commands: { 19 | init: gitInit.command, 20 | add: gitAdd.command, 21 | commit: gitCommit.command 22 | }, 23 | exitCodes: { 24 | init: gitInit.exitCode, 25 | add: gitAdd.exitCode, 26 | commit: gitCommit.exitCode 27 | } 28 | } 29 | } else { 30 | return { 31 | res: false, 32 | initOut: gitInit.stdout, 33 | addOut: gitAdd.stdout, 34 | commitOut: gitCommit.stderr, 35 | commands: { 36 | init: gitInit.command, 37 | add: gitAdd.command, 38 | commit: gitCommit.command 39 | }, 40 | exitCodes: { 41 | init: gitInit.exitCode, 42 | add: gitAdd.exitCode, 43 | commit: gitCommit.exitCode 44 | } 45 | } 46 | } 47 | } else { 48 | return { 49 | res: false, 50 | initOut: gitInit.stdout, 51 | addOut: gitAdd.stderr, 52 | commitOut: 'Not Executed', 53 | commands: { 54 | init: gitInit.command, 55 | add: gitAdd.command, 56 | commit: "Not Executed" 57 | }, 58 | exitCodes: { 59 | init: gitInit.exitCode, 60 | add: gitAdd.exitCode, 61 | commit: "Not Executed" 62 | } 63 | } 64 | } 65 | } else { 66 | return { 67 | res: false, 68 | initOut: gitInit.stderr, 69 | addOut: "Not Executed", 70 | commitOut: "Not Executed", 71 | commands: { 72 | init: gitInit.command, 73 | add: "Not Executed", 74 | commit: "Not Executed" 75 | }, 76 | exitCodes: { 77 | init: gitInit.exitCode, 78 | add: "Not Executed", 79 | commit: "Not Executed" 80 | } 81 | } 82 | } 83 | } catch(e) { 84 | console.log(e); 85 | return { 86 | res: false, 87 | initOut: e.stderr, 88 | addOut: e.stderr, 89 | commitOut: e.stderr, 90 | commands: { 91 | init: e.command, 92 | add: e.command, 93 | commit: e.command 94 | }, 95 | exitCodes: { 96 | init: e.exitCode, 97 | add: e.exitCode, 98 | commit: e.exitCode 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/backend/pushConfigKeys.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (appname, cwdPath, configObj) => { 5 | const backPath = path.resolve(cwdPath); 6 | try { 7 | const result = await execa(`heroku`,[`config:set`,`-a`,appname,`DBURL=${configObj.dburl}`,`SITE=${configObj.site}`,`EMAILID=${configObj.emailid}`,`EMAILPASS=${configObj.emailpass}`,`EMAILPORT=${configObj.emailport}`,`EMAILSERVICE=${configObj.emailservice}`,`EMAILSMTP=${configObj.emailsmtp}`,`ADMINEMAIL=${configObj.adminemail}`,`REPLYTOMAIL=${configObj.replyemail}`,`MAXSESSIONS=${configObj.maxsessions}`,`EMAILGIF=${configObj.emailgif}`,`SITESECRET=${configObj.sitesec}`,`TMDBAPI=${configObj.tmdbapi}`,`FRONTENDURL=${configObj.fronturls}`,`FRONTENDSITENAME=${configObj.frontname}`,`TOKENSECRET=${configObj.tokensec}`], { cwd: backPath }); 8 | if(!result.failed && !result.killed && !result.timedOut && !result.isCancelled){ 9 | return { 10 | res: true, 11 | output: result.stdout+'\n'+result.stderr, 12 | cmd: result.command, 13 | exitCode: result.exitCode 14 | }; 15 | } else { 16 | return { 17 | res: false, 18 | output: result.stdout+'\n'+result.stderr, 19 | cmd: result.command, 20 | exitCode: result.exitCode 21 | }; 22 | } 23 | } catch(e) { 24 | return { 25 | res: false, 26 | output: e.stdout+'\n'+e.stderr, 27 | cmd: e.command, 28 | exitCode: e.exitCode 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/frontend/getAllPrompts.js: -------------------------------------------------------------------------------- 1 | const inputPrompts = require('./inputPrompts'); 2 | 3 | const open = require('open'); 4 | const chalk = require('chalk'); 5 | 6 | const authUrl = 'https://accounts.google.com/o/oauth2/auth?client_id=202264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&approval_prompt=auto'; 7 | 8 | module.exports = async () => { 9 | let objs = {}; 10 | objs.appname = await inputPrompts.appname(); 11 | let theme = await inputPrompts.themename(); 12 | let variant = await inputPrompts.themeVariant(); 13 | objs.theme = variant+"-"+theme; 14 | objs.frontendurl = await inputPrompts.fronturl(); 15 | objs.backendurl = await inputPrompts.backurl(); 16 | objs.favicon = await inputPrompts.favicon(); 17 | objs.clientId = await inputPrompts.clientId(); 18 | objs.clientSecret = await inputPrompts.clientSec(); 19 | let getAuthCode = await inputPrompts.getAuthCode(); 20 | if(getAuthCode){ 21 | console.log(chalk.yellow.bold("\nOpening Auth Code Generator in Your Browser\n")) 22 | await open(authUrl); 23 | } 24 | objs.refreshToken = await inputPrompts.refreshTok(); 25 | objs.roots = []; 26 | let root0 = await inputPrompts.rootForm(); 27 | objs.roots.push(root0); 28 | let moreRootsConf = await inputPrompts.confRoot(); 29 | while (moreRootsConf){ 30 | let nexRoot = await inputPrompts.rootForm(); 31 | objs.roots.push(nexRoot); 32 | moreRootsConf = await inputPrompts.confRoot(); 33 | } 34 | objs.netflixBlack = await inputPrompts.netBlack(); 35 | objs.loadingImg = await inputPrompts.loadingImg(); 36 | objs.homeImg = await inputPrompts.homeImg(); 37 | objs.audioPoster = await inputPrompts.audioPoster(); 38 | objs.footLogoConf = await inputPrompts.footLogo(); 39 | if(objs.footLogoConf){ 40 | objs.footLogo = await inputPrompts.footImg(); 41 | } else { 42 | objs.footLogo = "" 43 | } 44 | objs.rootStr = ""; 45 | objs.roots.forEach((root) => { 46 | objs.rootStr += `{ 47 | id: "${root.id}", 48 | name: "${root.name}", 49 | protect_file_link: true 50 | },` 51 | }); 52 | return objs 53 | } 54 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/frontend/getLatIndex.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const frontendRegex = /^(frontend).+/; 3 | 4 | module.exports = async () => { 5 | return axios 6 | .get('https://api.github.com/repos/tks18/gindex-v4/releases') 7 | .then((resp) => { 8 | const result = resp.data.filter((releases) => { 9 | return frontendRegex.test(releases.tag_name) && !releases.prerelease; 10 | })[0].tag_name; 11 | return axios 12 | .get( 13 | `https://raw.githubusercontent.com/tks18/gindex-v4/master/worker/index.js`, 14 | ) 15 | .then((resp) => { 16 | replacedVersion = result.replace(/^(frontend-)/, ''); 17 | return { 18 | version: result, 19 | verNumber: replacedVersion, 20 | code: resp.data, 21 | }; 22 | }); 23 | }); 24 | }; 25 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/frontend/index.js: -------------------------------------------------------------------------------- 1 | const getLatIndex = require('./getLatIndex'); 2 | const replaceOpt = require('./replaceOpt'); 3 | const getAllPrompts = require('./getAllPrompts'); 4 | const inputPrompts = require('./inputPrompts'); 5 | const spinner = require('../../../helpers/spinner'); 6 | 7 | const open = require('open'); 8 | const chalk = require('chalk'); 9 | const clipboardy = require('clipboardy'); 10 | 11 | module.exports = async () => { 12 | spinner(true, 'Getting the Latest Index Code', 0, false, async (indexSpin) => { 13 | const latestIndex = await getLatIndex() 14 | indexSpin.stop(); 15 | console.log(chalk.green.bold("\nIndex Code has been Successfully Retrived, Now Enter the Required Details\n")) 16 | const getAllObjs = await getAllPrompts(); 17 | const finalIndexCode = await replaceOpt(latestIndex.code, getAllObjs, latestIndex.verNumber) 18 | clipboardy.writeSync(finalIndexCode); 19 | console.log(chalk.green.bold("\n Your Code has been Copied to Clipboard, You can Deploy by Pasting to Your Worker in Cloudflare\n")) 20 | process.exit(); 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/frontend/replaceOpt.js: -------------------------------------------------------------------------------- 1 | module.exports = (indexCode, configOpts, latestVer) => { 2 | var data = ` 3 | var authConfig = { 4 | siteName: "${configOpts.appname}", 5 | hybridpass: "Not Required", 6 | version: "${latestVer}", 7 | theme: "${configOpts.theme}", 8 | frontendUrl: "${configOpts.frontendurl}", 9 | github_name: "tks18", 10 | github_repo: "gindex-v4", 11 | favicon: "${configOpts.favicon}", 12 | client_id: "${configOpts.clientId}", 13 | backendSite: "${configOpts.backendurl}", 14 | client_secret: "${configOpts.clientSecret}", 15 | refresh_token: "${configOpts.refreshToken}", 16 | roots: [ 17 | ${configOpts.rootStr} 18 | ], 19 | default_gd: 0, 20 | files_list_page_size: 200, 21 | search_result_list_page_size: 50, 22 | enable_cors_file_down: false, 23 | enable_password_file_verify: true, 24 | }; 25 | 26 | var themeOptions = { 27 | languages: 'en', 28 | netflix_home: true, 29 | prefer_netflix_black: ${configOpts.netflixBlack}, 30 | loading_image: "${configOpts.loadingImg}", 31 | home_background_image: "${configOpts.homeImg}", 32 | audio: { 33 | default_poster: "${configOpts.audioPoster}", 34 | }, 35 | footer_data: { 36 | footer_logo: ${configOpts.footLogoConf}, 37 | footer_logo_link: "${configOpts.footLogo}", 38 | }, 39 | render: { 40 | head_md: false, 41 | readme_md: false, 42 | desc: true, 43 | } 44 | } 45 | ` 46 | let replacedData = indexCode.replace(/\/\/ =======Options START=======([\s\S]*)\/\/ =======Options END=======/, data) 47 | return replacedData 48 | } 49 | -------------------------------------------------------------------------------- /cli-tool/commands/deploy/index.js: -------------------------------------------------------------------------------- 1 | exports.backend = require("./backend"); 2 | exports.frontend = require("./frontend"); 3 | -------------------------------------------------------------------------------- /cli-tool/commands/index.js: -------------------------------------------------------------------------------- 1 | const { env } = require('./configure'); 2 | const { backend, frontend } = require('./deploy'); 3 | 4 | exports.init = require('./init'); 5 | exports.update = require('./update'); 6 | exports.configure = { 7 | env: env 8 | } 9 | exports.deploy = { 10 | backend: backend, 11 | frontend: frontend 12 | } 13 | -------------------------------------------------------------------------------- /cli-tool/commands/init/checkGitExists.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async () => { 4 | try { 5 | const result = await execa('git', ['--version']); 6 | const numRegex = /(git version).+/; 7 | if(numRegex.test(result.stdout)){ 8 | return { 9 | res: true, 10 | output: result.stdout, 11 | cmd: result.command, 12 | exitCode: result.exitCode 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode 20 | }; 21 | } 22 | } catch(e) { 23 | return { 24 | res: false, 25 | output: e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/init/checkNpmExists.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async () => { 4 | try { 5 | const result = await execa('npm', ['--v']); 6 | const numRegex = /([1-9]).+/; 7 | if(numRegex.test(result.stdout)){ 8 | return { 9 | res: true, 10 | output: result.stdout, 11 | cmd: result.command, 12 | exitCode: result.exitCode 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode 20 | }; 21 | } 22 | } catch(e) { 23 | return { 24 | res: false, 25 | output: e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/init/post-init.js: -------------------------------------------------------------------------------- 1 | const boxen = require('boxen'); 2 | const chalk = require('chalk'); 3 | 4 | const boxenOptions = { 5 | padding: 1, 6 | margin: 1, 7 | borderStyle: "round", 8 | borderColor: "green", 9 | }; 10 | 11 | module.exports = boxen('\n\n'+ 12 | chalk.bold.italic.green('Successfully Initiated Gindex CLI Tool') + 13 | '\n\n'+ 14 | 'It Looks Like all the Preqrequisites got Successfully Initialized '+'\n'+ 15 | 'and is Ready to Deploy Your Amazing Gindex Backend.'+'\n\n'+ 16 | 'Now Run the Following Command to Login to Heroku Account'+ '\n'+ 17 | chalk.bold.yellow('>> heroku login')+'\n\n'+ 18 | 'After Successfully Running the Above Command, Run the Following Command:'+'\n'+ 19 | chalk.bold.yellow('>> gdployer deploy')+'\n\n'+ 20 | 'and Follow the Onscreen Instruction to Deploy the Awesomeness with Ease.' 21 | , boxenOptions) 22 | -------------------------------------------------------------------------------- /cli-tool/commands/update/checkHerokuLogin.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | 3 | module.exports = async () => { 4 | try { 5 | const result = await execa('heroku', ['auth:token']); 6 | const tokenRegex = /(Warning: token will expire).+/; 7 | if(tokenRegex.test(result.stderr)){ 8 | return { 9 | res: true, 10 | output: result.stdout+'\n'+result.stderr, 11 | cmd: result.command, 12 | exitCode: result.exitCode 13 | }; 14 | } else { 15 | return { 16 | res: false, 17 | output: result.stdout+'\n'+result.stderr, 18 | cmd: result.command, 19 | exitCode: result.exitCode 20 | }; 21 | } 22 | } catch(e) { 23 | return { 24 | res: false, 25 | output: e.stdout+'\n'+e.stderr, 26 | cmd: e.command, 27 | exitCode: e.exitCode 28 | }; 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /cli-tool/commands/update/createTMP.js: -------------------------------------------------------------------------------- 1 | const tmp = require('tmp'); 2 | const path = require('path'); 3 | 4 | module.exports = (exFunc) => { 5 | try { 6 | return tmp.dir({ template: 'gindex-cli-XXXXXX' },async function _tempDirCreated(err, tmppath, cleanupCallback) { 7 | if (err) throw err; 8 | const resPath = await path.join(tmppath, 'backend'); 9 | await exFunc(tmppath, resPath); 10 | }); 11 | } catch(e) { 12 | console.log(e); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /cli-tool/commands/update/downloadUnzip.js: -------------------------------------------------------------------------------- 1 | const unzipper = require('unzipper'); 2 | const fs = require('fs'); 3 | const axios = require('axios'); 4 | const release = require('./getReleases'); 5 | 6 | module.exports = async (path, exfunc) => { 7 | let latVerUrl = await release(); 8 | return axios({ 9 | method: "get", 10 | url: `https://github.com/tks18/gindex-v4/releases/download/${latVerUrl.tag_name}/${latVerUrl.assets[0].name}`, 11 | responseType: "stream" 12 | }).then(resp => { 13 | resp.data.pipe(fs.createWriteStream(path+"/latest.zip").on('finish', () => { 14 | fs.createReadStream(path+"/latest.zip").pipe(unzipper.Extract({ path: path+'/backend' })).on('close', ()=> { 15 | exfunc(); 16 | }); 17 | })); 18 | }).catch(e => { 19 | return { 20 | res: false, 21 | output: e 22 | } 23 | }) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /cli-tool/commands/update/getReleases.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const backendRegex = /^(backend).+/; 3 | 4 | module.exports = () => { 5 | return axios.get('https://api.github.com/repos/tks18/gindex-v4/releases').then(resp => { 6 | const result = resp.data.filter(releases =>{ 7 | return backendRegex.test(releases.tag_name); 8 | })[0] 9 | return result 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /cli-tool/commands/update/gitCheckoutHApp.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (appname, cwdPath) => { 5 | let resPath = path.resolve(cwdPath); 6 | try { 7 | const result = await execa('heroku', ['git:remote','-a', appname], { cwd: resPath }); 8 | if(!result.failed && !result.killed && !result.timedOut && !result.isCancelled){ 9 | return { 10 | res: true, 11 | output: result.stdout+'\n'+result.stderr, 12 | cmd: result.command, 13 | exitCode: result.exitCode 14 | }; 15 | } else { 16 | return { 17 | res: false, 18 | output: result.stdout+'\n'+result.stderr, 19 | cmd: result.command, 20 | exitCode: result.exitCode 21 | }; 22 | } 23 | } catch(e) { 24 | return { 25 | res: false, 26 | output: e.stdout+'\n'+e.stderr, 27 | cmd: e.command, 28 | exitCode: e.exitCode 29 | }; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /cli-tool/commands/update/initBackendnCommit.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (backPath) => { 5 | try { 6 | let cwdPath = path.normalize(path.resolve(backPath)); 7 | const gitInit = await execa('git', ['init'], {cwd: cwdPath}); 8 | if(!gitInit.failed && !gitInit.killed && !gitInit.timedOut && !gitInit.isCancelled){ 9 | const gitAdd = await execa('git', ['add', '.'], {cwd: cwdPath}); 10 | if(!gitAdd.failed && !gitAdd.killed && !gitAdd.timedOut && !gitAdd.isCancelled){ 11 | const gitCommit = await execa('git', ['commit', '-m', '%Automated Bot Commit%'],{cwd: cwdPath}); 12 | if(!gitCommit.failed && !gitCommit.killed && !gitCommit.timedOut && !gitCommit.isCancelled){ 13 | return { 14 | res: true, 15 | initOut: gitInit.stdout, 16 | addOut: gitAdd.stdout, 17 | commitOut: gitCommit.stdout, 18 | commands: { 19 | init: gitInit.command, 20 | add: gitAdd.command, 21 | commit: gitCommit.command 22 | }, 23 | exitCodes: { 24 | init: gitInit.exitCode, 25 | add: gitAdd.exitCode, 26 | commit: gitCommit.exitCode 27 | } 28 | } 29 | } else { 30 | return { 31 | res: false, 32 | initOut: gitInit.stdout, 33 | addOut: gitAdd.stdout, 34 | commitOut: gitCommit.stderr, 35 | commands: { 36 | init: gitInit.command, 37 | add: gitAdd.command, 38 | commit: gitCommit.command 39 | }, 40 | exitCodes: { 41 | init: gitInit.exitCode, 42 | add: gitAdd.exitCode, 43 | commit: gitCommit.exitCode 44 | } 45 | } 46 | } 47 | } else { 48 | return { 49 | res: false, 50 | initOut: gitInit.stdout, 51 | addOut: gitAdd.stderr, 52 | commitOut: 'Not Executed', 53 | commands: { 54 | init: gitInit.command, 55 | add: gitAdd.command, 56 | commit: "Not Executed" 57 | }, 58 | exitCodes: { 59 | init: gitInit.exitCode, 60 | add: gitAdd.exitCode, 61 | commit: "Not Executed" 62 | } 63 | } 64 | } 65 | } else { 66 | return { 67 | res: false, 68 | initOut: gitInit.stderr, 69 | addOut: "Not Executed", 70 | commitOut: "Not Executed", 71 | commands: { 72 | init: gitInit.command, 73 | add: "Not Executed", 74 | commit: "Not Executed" 75 | }, 76 | exitCodes: { 77 | init: gitInit.exitCode, 78 | add: "Not Executed", 79 | commit: "Not Executed" 80 | } 81 | } 82 | } 83 | } catch(e) { 84 | console.log(e); 85 | return { 86 | res: false, 87 | initOut: e.stderr, 88 | addOut: e.stderr, 89 | commitOut: e.stderr, 90 | commands: { 91 | init: e.command, 92 | add: e.command, 93 | commit: e.command 94 | }, 95 | exitCodes: { 96 | init: e.exitCode, 97 | add: e.exitCode, 98 | commit: e.exitCode 99 | } 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /cli-tool/commands/update/inputPrompts.js: -------------------------------------------------------------------------------- 1 | const { prompt } = require('enquirer'); 2 | 3 | module.exports = { 4 | appName: async () => { 5 | const appNamePrompt = await prompt({ 6 | type: 'input', 7 | name: "appname", 8 | message: "Enter the Heroku appname that You have Created Before." 9 | }) 10 | return appNamePrompt.appname; 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /cli-tool/commands/update/pushBackend.js: -------------------------------------------------------------------------------- 1 | const execa = require('execa'); 2 | const path = require('path'); 3 | 4 | module.exports = async (cwdPath) => { 5 | const backPath = path.resolve(cwdPath); 6 | try { 7 | const result = await execa('git', ['push','heroku', 'master', '--force'], { cwd: backPath }); 8 | if(!result.failed && !result.killed && !result.timedOut && !result.isCancelled){ 9 | return { 10 | res: true, 11 | output: result.stdout+'\n'+result.stderr, 12 | cmd: result.command, 13 | exitCode: result.exitCode 14 | }; 15 | } else { 16 | return { 17 | res: false, 18 | output: result.stdout+'\n'+result.stderr, 19 | cmd: result.command, 20 | exitCode: result.exitCode 21 | }; 22 | } 23 | } catch(e) { 24 | return { 25 | res: false, 26 | output: e.stdout+'\n'+e.stderr, 27 | cmd: e.command, 28 | exitCode: e.exitCode 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cli-tool/displays/initial-render.js: -------------------------------------------------------------------------------- 1 | const chalk = require('chalk'); 2 | const clear = require('clear'); 3 | const figlet = require('figlet'); 4 | const boxen = require('boxen'); 5 | 6 | const boxenOptions = { 7 | padding: 1, 8 | margin: 1, 9 | borderStyle: "double", 10 | borderColor: "yellow" 11 | }; 12 | 13 | module.exports = function(){ 14 | clear(); 15 | return boxen( 16 | '\n' + chalk.red.bold( 17 | 'U L T I M A T E G - I N D E X D E P L O Y E R C L I T O O L \n\n' 18 | ) + 19 | chalk.green.bold( 20 | ' B Y \n\n' 21 | ) + 22 | chalk.blue.bold( 23 | figlet.textSync('Shan.tk', { 24 | font: 'Ghost', 25 | horizontalLayout: 'default', 26 | verticalLayout: 'default', 27 | width: 100, 28 | whitespaceBreak: true 29 | }) 30 | ), boxenOptions) + '\n\n' 31 | } 32 | -------------------------------------------------------------------------------- /cli-tool/displays/post-install.js: -------------------------------------------------------------------------------- 1 | const chalk = require('chalk'); 2 | const clear = require('clear'); 3 | const figlet = require('figlet'); 4 | const boxen = require('boxen'); 5 | 6 | const greeting = chalk.white.bold("Thanks ! for Installing the Ultimate Index \nDeployer all in one Tool."); 7 | 8 | const boxenOptions = { 9 | padding: 1, 10 | margin: 1, 11 | borderStyle: "double", 12 | borderColor: "green", 13 | }; 14 | clear() 15 | console.log( 16 | boxen( 17 | '\n\n' + chalk.white.bold( 18 | 'ULTIMATE G-INDEX DEPLOYER CLI TOOL\n\n' 19 | ) + 20 | chalk.yellow.bold( 21 | 'BY \n' 22 | ) + 23 | chalk.blue.bold( 24 | 'SHAN . TK \n' 25 | ) + '\n\n' + 26 | greeting + 27 | chalk.bold( 28 | `\n 29 | Following are the Commands Available:\n 30 | gdployer [command] 31 | 32 | Commands: 33 | gdployer init Initialize the Deployer (Will Check for all 34 | the Preqrequisites) 35 | gdployer deploy Deploy Your Backend(for Now) will Support 36 | Frontend after Some time 37 | gdployer update Update Your Backend to latest Version 38 | gdployer configure --env Update Your Backend Variables 39 | 40 | Options: 41 | --help Show help [boolean] 42 | --version Show version number [boolean] 43 | ` 44 | ) 45 | , boxenOptions) 46 | ); 47 | -------------------------------------------------------------------------------- /cli-tool/helpers/configStore.js: -------------------------------------------------------------------------------- 1 | const Conf = require('conf'); 2 | 3 | const schema = { 4 | name: { 5 | type: 'string', 6 | default: 'Anonymous' 7 | }, 8 | init: { 9 | type: "object", 10 | properties: { 11 | checked: { 12 | type: 'boolean', 13 | default: false 14 | }, 15 | git: { 16 | type: 'object', 17 | default: {}, 18 | }, 19 | npm: { 20 | type: 'object', 21 | default: {}, 22 | }, 23 | heroku: { 24 | type: 'object', 25 | default: {}, 26 | }, 27 | } 28 | } 29 | } 30 | 31 | const config = new Conf({schema}); 32 | module.exports = config 33 | -------------------------------------------------------------------------------- /cli-tool/helpers/spinner.js: -------------------------------------------------------------------------------- 1 | var CLI = require('clui'), 2 | Spinner = CLI.Spinner; 3 | module.exports = function (indefinite, message, seconds, showSec, exFunc) { 4 | if (indefinite) { 5 | var countdown = new Spinner(message, [ 6 | 'G', 7 | '-', 8 | 'I', 9 | 'N', 10 | 'D', 11 | 'E', 12 | 'X', 13 | '-', 14 | '-', 15 | 'S', 16 | 'H', 17 | 'A', 18 | 'N', 19 | '.', 20 | 'T', 21 | 'K', 22 | ]); 23 | countdown.start(); 24 | exFunc(countdown); 25 | } else { 26 | if (!showSec) { 27 | var countdown = new Spinner(message, [ 28 | 'G', 29 | '-', 30 | 'I', 31 | 'N', 32 | 'D', 33 | 'E', 34 | 'X', 35 | '-', 36 | '-', 37 | 'S', 38 | 'H', 39 | 'A', 40 | 'N', 41 | '.', 42 | 'T', 43 | 'K', 44 | ]); 45 | countdown.start(); 46 | var number = 3; 47 | setInterval(function () { 48 | number--; 49 | countdown.message(message); 50 | if (number === 0) { 51 | countdown.stop(); 52 | exFunc(); 53 | } 54 | }, 1000); 55 | } else { 56 | var countdown = new Spinner(message + ' ' + seconds + ' seconds... ', [ 57 | 'G', 58 | '-', 59 | 'I', 60 | 'N', 61 | 'D', 62 | 'E', 63 | 'X', 64 | '-', 65 | '-', 66 | 'S', 67 | 'H', 68 | 'A', 69 | 'N', 70 | '.', 71 | 'T', 72 | 'K', 73 | ]); 74 | countdown.start(); 75 | var number = seconds; 76 | setInterval(function () { 77 | number--; 78 | countdown.message(message + ' ' + number + ' seconds... '); 79 | if (number === 0) { 80 | countdown.stop(); 81 | exFunc(); 82 | } 83 | }, 1000); 84 | } 85 | } 86 | }; 87 | -------------------------------------------------------------------------------- /cli-tool/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const spinner = require('./helpers/spinner'); 4 | const yargs = require('yargs'); 5 | const { hideBin } = require('yargs/helpers'); 6 | const initialRender = require('./displays/initial-render'); 7 | const { Select } = require('enquirer'); 8 | const { init, deploy, update, configure } = require('./commands'); 9 | 10 | console.log(initialRender()); 11 | 12 | yargs(hideBin(process.argv)) 13 | .command( 14 | 'init', 15 | 'Initialize the Deployer (Will Check for all the Preqrequisites)', 16 | {}, 17 | (args) => { 18 | init(); 19 | }, 20 | ) 21 | .command( 22 | 'deploy [type]', 23 | 'Deploy Your Backend(for Now) will Support Frontend after Some time', 24 | {}, 25 | (args) => { 26 | spinner(false, `Getting Ready Man!! Wait`, 2, false, function () { 27 | if (args.type != 'frontend' || args.type != 'backend') { 28 | new Select({ 29 | name: 'deploytype', 30 | message: 'Select the Part which You want to Deploy', 31 | choices: ['Frontend', 'Backend'], 32 | }) 33 | .run() 34 | .then((answer) => { 35 | if (answer.toLowerCase() == 'backend') { 36 | deploy.backend(); 37 | } else if (answer.toLowerCase() == 'frontend') { 38 | deploy.frontend(); 39 | } 40 | }) 41 | .catch((e) => { 42 | console.log('Error Occured in the Instance'); 43 | process.exit(); 44 | }); 45 | } else { 46 | if (args.type == 'frontend') { 47 | deploy.frontend(); 48 | } else if (args.type == 'backend') { 49 | deploy.backend(); 50 | } 51 | } 52 | }); 53 | }, 54 | ) 55 | .command('update', 'Update Your Backend to latest Version', {}, (args) => { 56 | spinner(false, `Initializing Now`, 2, false, function () { 57 | update(); 58 | }); 59 | }) 60 | .command('configure [env]', 'Update Your Backend Variables', {}, (args) => { 61 | if (args.env) { 62 | configure.env(); 63 | } else { 64 | console.log( 65 | 'More Options Will be Supported later. For Now only Backend Variables Configuration is Enabled', 66 | ); 67 | } 68 | }).argv; 69 | 70 | if (yargs.argv._.length < 1) { 71 | yargs.showHelp(); 72 | } 73 | -------------------------------------------------------------------------------- /cli-tool/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gindex-cli-tool", 3 | "version": "1.7.0", 4 | "description": "A Cli Tool to Publish Google Drive Index's Frontend and Backend all in One Tool", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "postinstall": "node displays/post-install.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/tks18/gindex-v4.git" 13 | }, 14 | "keywords": [ 15 | "gindex", 16 | "tks18", 17 | "google", 18 | "drive" 19 | ], 20 | "author": "tks18", 21 | "license": "GPL-3.0-or-later", 22 | "bugs": { 23 | "url": "https://github.com/tks18/gindex-v4/issues" 24 | }, 25 | "bin": { 26 | "gdployer": "./index.js" 27 | }, 28 | "homepage": "https://github.com/tks18/gindex-v4#readme", 29 | "dependencies": { 30 | "axios": "^0.21.0", 31 | "boxen": "^4.2.0", 32 | "chalk": "^4.1.0", 33 | "clear": "^0.1.0", 34 | "clipboardy": "^2.3.0", 35 | "clui": "^0.3.6", 36 | "conf": "^7.1.2", 37 | "email-prompt": "^0.3.2", 38 | "enquirer": "^2.3.6", 39 | "execa": "^4.1.0", 40 | "figlet": "^1.5.0", 41 | "open": "^7.3.0", 42 | "tmp": "^0.2.1", 43 | "unzipper": "^0.10.11", 44 | "yargs": "^16.1.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /imgs/adminpage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/adminpage.jpg -------------------------------------------------------------------------------- /imgs/home-nolog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/home-nolog.png -------------------------------------------------------------------------------- /imgs/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/home.png -------------------------------------------------------------------------------- /imgs/home2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/home2.png -------------------------------------------------------------------------------- /imgs/homelogged.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/homelogged.jpeg -------------------------------------------------------------------------------- /imgs/homelogout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/homelogout.jpg -------------------------------------------------------------------------------- /imgs/login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/login.jpg -------------------------------------------------------------------------------- /imgs/newuserregister.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/newuserregister.jpg -------------------------------------------------------------------------------- /imgs/pendinguser.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/pendinguser.jpeg -------------------------------------------------------------------------------- /imgs/request.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/request.jpeg -------------------------------------------------------------------------------- /imgs/settings.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/settings.jpg -------------------------------------------------------------------------------- /imgs/verify.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/verify.jpeg -------------------------------------------------------------------------------- /imgs/videoPlayer Modal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/videoPlayer Modal.jpg -------------------------------------------------------------------------------- /imgs/videoPlayer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/videoPlayer.jpg -------------------------------------------------------------------------------- /imgs/videplayer2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/imgs/videplayer2.jpg -------------------------------------------------------------------------------- /scripts/before-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ ${TRAVIS_BRANCH} == "master" ] && [ ${TRAVIS_PULL_REQUEST} == "false" ]; then 4 | bash ./scripts/prod-build.sh 5 | else 6 | bash ./scripts/dev-build.sh 7 | fi -------------------------------------------------------------------------------- /scripts/dev-after-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | printf "\nDoing After Deployment Activities\n" 4 | 5 | GIT_URL="github.com/tks18/gindex-v4.git" 6 | FT_DEPLOY_DIR="ft-deploy-tmp" 7 | BE_DEPLOY_DIR="be-deploy-tmp" 8 | CLI_DEPLOY_DIR="cli-deploy-tmp" 9 | VM_DEPLOY_DIR="vm-deploy-tmp" 10 | 11 | git config --global user.name "tks18" 12 | git config --global user.email "tksudharshan@gmail.com" 13 | 14 | printf "\nPublishing Frontend\n" 15 | rm -rf vuejs/node_modules/* 16 | rm -rf vuejs/.yarn/cache/* 17 | rm -rf vuejs/outputs/* 18 | git clone --single-branch --depth 3 --quiet -b frontend-dev https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${FT_DEPLOY_DIR} 19 | cd ${FT_DEPLOY_DIR} 20 | rm -rf * 21 | cp -r ../vuejs/. . 22 | git add . 23 | git commit -m "Deploying Frontend for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 24 | git push --quiet -u --no-progress origin frontend-dev 25 | 26 | cd .. 27 | rm -rf ${FT_DEPLOY_DIR}/* 28 | 29 | printf "\nPublishing Backend\n" 30 | git clone --single-branch --depth 3 --quiet -b backend-dev https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${BE_DEPLOY_DIR} 31 | cd ${BE_DEPLOY_DIR} 32 | rm -rf * 33 | cp -r ../backend/. . 34 | git add . 35 | git commit -m "Deploying Backend for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 36 | git push --quiet -u --no-progress origin backend-dev 37 | 38 | cd .. 39 | rm -rf ${BE_DEPLOY_DIR}/* 40 | 41 | printf "\nPublishing CLI Tool\n" 42 | git clone --single-branch --depth 3 --quiet -b cli-tool-dev https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${CLI_DEPLOY_DIR} 43 | cd ${CLI_DEPLOY_DIR} 44 | rm -rf * 45 | cp -r ../cli-tool/. . 46 | git add . 47 | git commit -m "Deploying CLI-Tool for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 48 | git push --quiet -u --no-progress origin cli-tool-dev 49 | 50 | cd .. 51 | rm -rf ${CLI_DEPLOY_DIR}/* 52 | 53 | printf "\nPublishing Version Manager Tool\n" 54 | git clone --single-branch --depth 3 --quiet -b version-manager-dev https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${VM_DEPLOY_DIR} 55 | cd ${VM_DEPLOY_DIR} 56 | rm -rf * 57 | cp -r ../version-manager/. . 58 | git add . 59 | git commit -m "Deploying Version Manager for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 60 | git push --quiet -u --no-progress origin version-manager-dev 61 | 62 | cd .. 63 | rm -rf ${VM_DEPLOY_DIR}/* 64 | 65 | rm -rf vuejs/* 66 | rm -rf backend/* 67 | rm -rf cli-tool/* 68 | 69 | printf "Successfully Deployed all the Modules" 70 | 71 | -------------------------------------------------------------------------------- /scripts/dev-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd vuejs 4 | printf "Setting Default Environment Variables" 5 | export VUE_APP_SECRET_PASS=${SECRET_PASS} 6 | export VUE_APP_BUILD=dev 7 | export VUE_APP_LOCAL=false 8 | export VUE_APP_CDN_PATH=https://cdn.jsdelivr.net/gh/tks18/gindex-v4@master/themes/THEME/ 9 | printf "\n" 10 | printf "Getting Latest themes and Variants" 11 | themes_list=("carnation" "curious-blue" "emerald" "ice-cold" "konifer" "netflix-red" "kournikova" "mona-lisa" "persian-rose" "purple-heart" "purple-mountains-majesty" "salmon" "selective-yellow" "shamrock" "witch-haze") 12 | 13 | printf "\nDeleting old Builds\n\n" 14 | rm -rf outputs/* 15 | dest_dir="outputs/themes" 16 | mkdir -p dest_dir 17 | 18 | for theme in ${themes_list[@]}; do 19 | export VUE_APP_THEME=${theme} 20 | printf "\nBuilding Assets for ${theme}\n\n" 21 | theme_dir="${dest_dir}/${theme}" 22 | mkdir -p ${theme_dir} 23 | yarn build --silent 24 | mv ./dist/* ${theme_dir}/. 25 | done -------------------------------------------------------------------------------- /scripts/dev-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GIT_URL="github.com/tks18/gindex-v4.git" 4 | DEPLOY_DIR="deploy-tmp" 5 | 6 | git config --global user.name "tks18" 7 | git config --global user.email "tksudharshan@gmail.com" 8 | 9 | git clone --single-branch --depth 3 --quiet -b dev-build https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${DEPLOY_DIR} 10 | cd ${DEPLOY_DIR} 11 | rm -rf * 12 | cp -r ../vuejs/outputs/. . 13 | mkdir worker 14 | cp ../worker/. worker/. 15 | git add . 16 | git commit -m "Deploying ${TRAVIS_BUILD_ID}-${TRAVIS_BUILD_NUMBER}: ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 17 | git push origin dev-build 18 | 19 | cd .. 20 | 21 | bash ./scripts/dev-after-deploy.sh 22 | bash ./scripts/dev-release.sh -------------------------------------------------------------------------------- /scripts/dev-release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd version-manager 4 | npm i 5 | 6 | repo=https://github.com/tks18/gindex-v4 7 | 8 | printf "Publishing Frontend" 9 | node . publish --repo ${repo} --dev --branch dev-build --type frontend 10 | 11 | printf "Publishing Backend" 12 | node . publish --repo ${repo} --dev --branch backend-dev --type backend 13 | 14 | printf "Publishing CLI Tool" 15 | node . publish --repo ${repo} --dev --branch cli-tool-dev --type clitool 16 | 17 | printf "Publishing Version Manager Tool" 18 | node . publish --repo ${repo} --dev --branch version-manager-dev --type versionmanager -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd vuejs 4 | yarn install -------------------------------------------------------------------------------- /scripts/prod-after-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | printf "\nDoing After Deployment Activities\n" 4 | 5 | GIT_URL="github.com/tks18/gindex-v4.git" 6 | FT_DEPLOY_DIR="ft-deploy-tmp" 7 | BE_DEPLOY_DIR="be-deploy-tmp" 8 | CLI_DEPLOY_DIR="cli-deploy-tmp" 9 | VM_DEPLOY_DIR="vm-deploy-tmp" 10 | 11 | git config --global user.name "tks18" 12 | git config --global user.email "tksudharshan@gmail.com" 13 | 14 | printf "\nPublishing Frontend\n" 15 | rm -rf vuejs/node_modules/* 16 | rm -rf vuejs/.yarn/cache/* 17 | rm -rf vuejs/outputs/* 18 | git clone --single-branch --depth 3 --quiet -b frontend https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${FT_DEPLOY_DIR} 19 | cd ${FT_DEPLOY_DIR} 20 | rm -rf * 21 | cp -r ../vuejs/. . 22 | git add . 23 | git commit -m "Deploying Frontend for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 24 | git push --quiet -u --no-progress origin frontend 25 | 26 | cd .. 27 | rm -rf ${FT_DEPLOY_DIR}/* 28 | 29 | printf "\nPublishing Backend\n" 30 | git clone --single-branch --depth 3 --quiet -b backend https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${BE_DEPLOY_DIR} 31 | cd ${BE_DEPLOY_DIR} 32 | rm -rf * 33 | cp -r ../backend/. . 34 | git add . 35 | git commit -m "Deploying Backend for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 36 | git push --quiet -u --no-progress origin backend 37 | 38 | cd .. 39 | rm -rf ${BE_DEPLOY_DIR}/* 40 | 41 | printf "\nPublishing CLI Tool\n" 42 | git clone --single-branch --depth 3 --quiet -b cli-tool https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${CLI_DEPLOY_DIR} 43 | cd ${CLI_DEPLOY_DIR} 44 | rm -rf * 45 | cp -r ../cli-tool/. . 46 | git add . 47 | git commit -m "Deploying CLI-Tool for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 48 | git push --quiet -u --no-progress origin cli-tool 49 | 50 | cd .. 51 | rm -rf ${CLI_DEPLOY_DIR}/* 52 | 53 | printf "\nPublishing Version Manager Tool\n" 54 | git clone --single-branch --depth 3 --quiet -b version-manager https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${VM_DEPLOY_DIR} 55 | cd ${VM_DEPLOY_DIR} 56 | rm -rf * 57 | cp -r ../version-manager/. . 58 | git add . 59 | git commit -m "Deploying Version Manager for ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 60 | git push --quiet -u --no-progress origin version-manager 61 | 62 | cd .. 63 | rm -rf ${VM_DEPLOY_DIR}/* 64 | 65 | rm -rf vuejs/* 66 | rm -rf backend/* 67 | rm -rf cli-tool/* 68 | 69 | printf "Successfully Deployed all the Modules" 70 | 71 | -------------------------------------------------------------------------------- /scripts/prod-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd vuejs 4 | printf "Setting Default Environment Variables" 5 | export VUE_APP_SECRET_PASS=${SECRET_PASS} 6 | export VUE_APP_BUILD=prod 7 | export VUE_APP_LOCAL=false 8 | export VUE_APP_CDN_PATH=https://cdn.jsdelivr.net/gh/tks18/gindex-v4@master/themes/THEME/ 9 | printf "\n" 10 | printf "Getting Latest themes and Variants" 11 | themes_list=("carnation" "curious-blue" "emerald" "ice-cold" "konifer" "netflix-red" "kournikova" "mona-lisa" "persian-rose" "purple-heart" "purple-mountains-majesty" "salmon" "selective-yellow" "shamrock" "witch-haze") 12 | 13 | printf "\nDeleting old Builds\n\n" 14 | rm -rf outputs/* 15 | dest_dir="outputs/themes" 16 | mkdir -p dest_dir 17 | 18 | for theme in ${themes_list[@]}; do 19 | export VUE_APP_THEME=${theme} 20 | printf "\nBuilding Assets for ${theme}\n\n" 21 | theme_dir="${dest_dir}/${theme}" 22 | mkdir -p ${theme_dir} 23 | yarn build --silent 24 | mv ./dist/* ${theme_dir}/. 25 | done -------------------------------------------------------------------------------- /scripts/prod-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GIT_URL="github.com/tks18/gindex-v4.git" 4 | DEPLOY_DIR="deploy-tmp" 5 | 6 | git config --global user.name "tks18" 7 | git config --global user.email "tksudharshan@gmail.com" 8 | 9 | git clone --single-branch --depth 3 --quiet -b build https://tks18:${GITHUB_TOKEN}@${GIT_URL} ${DEPLOY_DIR} 10 | cd ${DEPLOY_DIR} 11 | rm -rf * 12 | cp -r ../vuejs/outputs/. . 13 | mkdir worker 14 | cp ../worker/. worker/. 15 | git add . 16 | git commit -m "Deploying ${TRAVIS_BUILD_ID}-${TRAVIS_BUILD_NUMBER}: ${TRAVIS_COMMIT}-${TRAVIS_COMMIT_MESSAGE}" 17 | git push origin build 18 | 19 | cd .. 20 | 21 | bash ./scripts/prod-after-deploy.sh 22 | bash ./scripts/prod-release.sh -------------------------------------------------------------------------------- /scripts/prod-release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd version-manager 4 | npm i 5 | 6 | repo=https://github.com/tks18/gindex-v4 7 | 8 | printf "Publishing Frontend" 9 | node . publish --repo ${repo} --branch build --type frontend 10 | 11 | printf "Publishing Backend" 12 | node . publish --repo ${repo} --branch backend --type backend 13 | 14 | printf "Publishing CLI Tool" 15 | node . publish --repo ${repo} --branch cli-tool --type clitool 16 | 17 | printf "Publishing Version Manager Tool" 18 | node . publish --repo ${repo} --branch version-manager-dev --type versionmanager -------------------------------------------------------------------------------- /version-manager/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .npmrc 3 | .npmrcs 4 | .env -------------------------------------------------------------------------------- /version-manager/app.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('dotenv').config(); 4 | const yargs = require('yargs'); 5 | const { hideBin } = require('yargs/helpers'); 6 | const spinner = require('./helpers/spinner'); 7 | const { checkArgs, handlePublish } = require('./publish'); 8 | const versionInfo = require('../version.json'); 9 | 10 | const catchFunc = (error, spinner) => { 11 | spinner.stop(); 12 | console.log(error); 13 | console.log('Failed'); 14 | }; 15 | 16 | yargs(hideBin(process.argv)).command( 17 | 'publish [type] [repo] [branch] [dev]', 18 | 'Publish Frontend, Backend, CLI-Tool, Version Control, Worker Version Automatically with Diff', 19 | {}, 20 | (args) => { 21 | spinner('Inititalizing App', (baseSpinner) => { 22 | const checks = checkArgs(args, versionInfo); 23 | baseSpinner.stop(); 24 | if (checks.passes) { 25 | handlePublish(checks) 26 | .then((result) => { 27 | if (result && !result.error) { 28 | console.log('Successfully Deployed the Release'); 29 | } else { 30 | console.log('Failed to Deploy the Release'); 31 | } 32 | }) 33 | .catch((err) => { 34 | console.log(err); 35 | }); 36 | } else { 37 | console.log('Wrong Options Given Try Again'); 38 | } 39 | }); 40 | }, 41 | ); 42 | 43 | if (yargs.argv._.length < 1) { 44 | yargs.showHelp(); 45 | } 46 | -------------------------------------------------------------------------------- /version-manager/helpers/get-commits.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | const token = process.env.GITHUB_TOKEN; 4 | 5 | const api = (user, repo, branch) => 6 | `https://tks18:${token}@api.github.com/repos/${user}/${repo}/commits?sha=${branch}`; 7 | 8 | module.exports = async (user, repo, branch) => { 9 | const url = api(user, repo, branch); 10 | let result = { 11 | success: false, 12 | commit: false, 13 | error: null, 14 | }; 15 | const response = await axios 16 | .get(url) 17 | .then((response) => { 18 | if (response.status == 200 && response.data) { 19 | const [latestCommit] = response.data; 20 | result['success'] = true; 21 | result['commit'] = latestCommit; 22 | } 23 | return result; 24 | }) 25 | .catch((error) => { 26 | result['error'] = error; 27 | return result; 28 | }); 29 | return response; 30 | }; 31 | -------------------------------------------------------------------------------- /version-manager/helpers/get-diff.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | const token = process.env.GITHUB_TOKEN; 4 | 5 | const api = (user, repo, commit) => 6 | `https://tks18:${token}@api.github.com/repos/${user}/${repo}/commits/${commit}`; 7 | 8 | module.exports = async (user, repo, commit) => { 9 | const url = api(user, repo, commit); 10 | let result = { 11 | success: false, 12 | changelog: null, 13 | error: null, 14 | }; 15 | const response = await axios 16 | .get(url) 17 | .then((response) => { 18 | if (response.status == 200 && response.data) { 19 | const { stats, files } = response.data; 20 | mappedFiles = files.map((file) => { 21 | return { 22 | name: file.filename, 23 | sha: file.sha, 24 | status: file.status, 25 | }; 26 | }); 27 | result['changelog'] = { 28 | stats, 29 | files: mappedFiles, 30 | }; 31 | result['success'] = true; 32 | } 33 | return result; 34 | }) 35 | .catch((error) => { 36 | result['error'] = error; 37 | return result; 38 | }); 39 | return response; 40 | }; 41 | -------------------------------------------------------------------------------- /version-manager/helpers/get-releases.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | const token = process.env.GITHUB_TOKEN; 4 | 5 | const api = (user, repo) => 6 | `https://tks18:${token}@api.github.com/repos/${user}/${repo}/releases`; 7 | 8 | module.exports = async (user, repo, versionToRelease) => { 9 | const url = api(user, repo); 10 | let result = { 11 | success: false, 12 | releases: false, 13 | error: null, 14 | }; 15 | const response = await axios 16 | .get(url) 17 | .then((response) => { 18 | if (response.status == 200 && response.data) { 19 | const release_tags = response.data.map((release) => { 20 | return release.tag_name.toLowerCase(); 21 | }); 22 | if (release_tags.includes(versionToRelease.tag.toLowerCase())) { 23 | result['success'] = false; 24 | result['releases'] = { 25 | exists: true, 26 | }; 27 | } else { 28 | result['success'] = true; 29 | result['releases'] = { 30 | exists: false, 31 | }; 32 | } 33 | } 34 | return result; 35 | }) 36 | .catch((error) => { 37 | result['error'] = error; 38 | return result; 39 | }); 40 | return response; 41 | }; 42 | -------------------------------------------------------------------------------- /version-manager/helpers/push-release.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | const token = process.env.GITHUB_TOKEN; 4 | 5 | const api = (user, repo) => 6 | `https://tks18:${token}@api.github.com/repos/${user}/${repo}/releases`; 7 | 8 | module.exports = async ( 9 | user, 10 | repo, 11 | name, 12 | version, 13 | branch, 14 | body, 15 | prerelease, 16 | ) => { 17 | const url = api(user, repo); 18 | let result = { 19 | success: false, 20 | commit: null, 21 | error: null, 22 | }; 23 | const response = await axios 24 | .post( 25 | url, 26 | { 27 | name, 28 | body, 29 | owner: user, 30 | repo, 31 | prerelease, 32 | tag_name: version.tag, 33 | target_commitish: branch, 34 | }, 35 | { 36 | Headers: { 37 | Accept: 'application/vnd.github.v3+json', 38 | }, 39 | }, 40 | ) 41 | .then((resp) => { 42 | if (resp.status == 200 && resp.data) { 43 | result['commit'] = resp.data; 44 | result['success'] = true; 45 | } 46 | return result; 47 | }) 48 | .catch((error) => { 49 | result['error'] = error; 50 | return result; 51 | }); 52 | return response; 53 | }; 54 | -------------------------------------------------------------------------------- /version-manager/helpers/spinner.js: -------------------------------------------------------------------------------- 1 | var CLI = require('clui'), 2 | Spinner = CLI.Spinner; 3 | 4 | module.exports = function (message, exFunc) { 5 | var countdown = new Spinner(message, [ 6 | 'G', 7 | '-', 8 | 'I', 9 | 'N', 10 | 'D', 11 | 'E', 12 | 'X', 13 | '-', 14 | '-', 15 | 'S', 16 | 'H', 17 | 'A', 18 | 'N', 19 | '.', 20 | 'T', 21 | 'K', 22 | ]); 23 | countdown.start(); 24 | exFunc(countdown); 25 | }; 26 | -------------------------------------------------------------------------------- /version-manager/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gindex-version-manager", 3 | "version": "0.1.0", 4 | "description": "A Version Manager and Git Manager for all the repos Available in Gindex Repo", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/tks18/gindex-v4/tree/master/version-manager" 12 | }, 13 | "bin": { 14 | "gd-control": "./app.js" 15 | }, 16 | "keywords": [ 17 | "Version", 18 | "Control", 19 | "Gindex-v4" 20 | ], 21 | "author": "tks18", 22 | "license": "MIT", 23 | "dependencies": { 24 | "axios": "^0.21.1", 25 | "clear": "^0.1.0", 26 | "clui": "^0.3.6", 27 | "dotenv": "^10.0.0", 28 | "yargs": "^17.0.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /version-manager/publish/checks.js: -------------------------------------------------------------------------------- 1 | module.exports = (args, releaseTypes) => { 2 | const repoRegex = /(?https:\/\/github.com)\/(?[a-zA-Z0-9].*)\/(?[a-zA-Z0-9].*)/; 3 | const { repo: repoSlug, branch, dev, type } = args; 4 | let result = {}; 5 | if (repoSlug && repoRegex.test(repoSlug)) { 6 | result['passes'] = true; 7 | const { server, user, repo } = repoSlug.match(repoRegex).groups; 8 | result['server'] = server; 9 | result['user'] = user; 10 | result['repo'] = repo; 11 | result['branch'] = branch; 12 | if (dev) { 13 | result['dev'] = true; 14 | } else { 15 | result['dev'] = false; 16 | } 17 | for (const releaseType in releaseTypes) { 18 | if (type.toLowerCase() === releaseType.toLowerCase()) { 19 | result['version'] = { 20 | exists: true, 21 | }; 22 | result.version = { 23 | ...result.version, 24 | ...releaseTypes[releaseType], 25 | }; 26 | } 27 | } 28 | } else { 29 | result['passes'] = false; 30 | } 31 | return result; 32 | }; 33 | -------------------------------------------------------------------------------- /version-manager/publish/handle-publish.js: -------------------------------------------------------------------------------- 1 | const getCommits = require('../helpers/get-commits'); 2 | const getDiff = require('../helpers/get-diff'); 3 | const getReleases = require('../helpers/get-releases'); 4 | const pushRelease = require('../helpers/push-release'); 5 | const publishRelease = require('../templates/publish-release'); 6 | 7 | module.exports = async (options) => { 8 | const { user, repo, branch, version, dev } = options; 9 | const latestCommit = await getCommits(user, repo, branch); 10 | if (latestCommit.success) { 11 | const { 12 | releases: { production, development }, 13 | } = version; 14 | const releaseVersion = dev ? development : production; 15 | const checkReleases = await getReleases(user, repo, releaseVersion); 16 | if (checkReleases.success && !checkReleases.releases.exists) { 17 | const diff = await getDiff(user, repo, latestCommit.commit.sha); 18 | if (diff.success) { 19 | const { title, message } = publishRelease( 20 | user, 21 | repo, 22 | dev, 23 | latestCommit.commit.sha, 24 | version, 25 | releaseVersion, 26 | diff.changelog, 27 | ); 28 | const releaseStatus = await pushRelease( 29 | user, 30 | repo, 31 | title, 32 | releaseVersion, 33 | branch, 34 | message, 35 | dev, 36 | ); 37 | if (releaseStatus.success) { 38 | return releaseStatus.commit; 39 | } else { 40 | return { success: false }; 41 | } 42 | } else { 43 | return { 44 | success: false, 45 | }; 46 | } 47 | } else { 48 | return { 49 | success: false, 50 | }; 51 | } 52 | } else { 53 | return { 54 | success: false, 55 | }; 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /version-manager/publish/index.js: -------------------------------------------------------------------------------- 1 | module.exports.handlePublish = require('./handle-publish'); 2 | module.exports.checkArgs = require('./checks'); 3 | -------------------------------------------------------------------------------- /version-manager/templates/publish-release.js: -------------------------------------------------------------------------------- 1 | module.exports = ( 2 | user, 3 | repo, 4 | dev, 5 | commitSha, 6 | versionInfo, 7 | version, 8 | changelog, 9 | ) => { 10 | const title = `${versionInfo.name} Update - ${version.version}`; 11 | const mdTitle = `**${title}**\n`; 12 | const devLabel = dev ? `**_Pre-release / WIP Version_**\n` : ''; 13 | const { files, stats } = changelog; 14 | const threshold = files.length > 10; 15 | const descriptiveFiles = files.splice(0, threshold ? 11 : files.length); 16 | let nonDescriptiveFiles, addedFiles, removedFiles, modifiedFiles; 17 | if (threshold) { 18 | nonDescriptiveFiles = files.splice(11, files.length - 1); 19 | addedFiles = nonDescriptiveFiles.filter((file) => file.status == 'added') 20 | .length; 21 | removedFiles = nonDescriptiveFiles.filter( 22 | (file) => file.status == 'removed', 23 | ).length; 24 | modifiedFiles = nonDescriptiveFiles.filter( 25 | (file) => file.status == 'modified', 26 | ).length; 27 | } else { 28 | addedFiles = 0; 29 | removedFiles = 0; 30 | modifiedFiles = 0; 31 | } 32 | let body = '\n\n'; 33 | body += `**_Changelog for [${commitSha.slice( 34 | 0, 35 | 7, 36 | )}](https://github.com/${user}/${repo}/commit/${commitSha})_**\n\n`; 37 | for (const file of descriptiveFiles) { 38 | body += `* ${file.status} - ${file.name}\n`; 39 | } 40 | const addedStatement = addedFiles > 0 ? `✅ ${addedFiles} Files Added,` : ''; 41 | const modifiedStatement = 42 | modifiedFiles > 0 ? `⛓ ${modifiedFiles} Files Modified, ` : ''; 43 | const removedStatement = 44 | removedFiles > 0 ? `❌ ${removedFiles} Files Removed` : ''; 45 | if (addedFiles > 0 || removedFiles > 0 || modifiedFiles > 0) { 46 | body += `* More ${addedStatement}${modifiedStatement}${removedStatement}\n\n`; 47 | } else { 48 | body += '\n'; 49 | } 50 | 51 | body += `**Total: ${stats.total}, Additions: ✅${stats.additions}, Deletions: ❌${stats.deletions}**`; 52 | 53 | const message = mdTitle + devLabel + body; 54 | return { title, message }; 55 | }; 56 | -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "frontend": { 3 | "location": "./vuejs", 4 | "folder": "vuejs", 5 | "name": "Frontend", 6 | "url": "https://github.com/tks18/gindex-v4/tree/master/vuejs", 7 | "releases": { 8 | "production": { 9 | "tag": "frontend-8.4.6", 10 | "version": "v8.4.6" 11 | }, 12 | "development": { 13 | "tag": "frontend-8.4.6.100", 14 | "version": "v8.4.6.100" 15 | } 16 | } 17 | }, 18 | "backend": { 19 | "location": "./backend", 20 | "folder": "backend", 21 | "name": "Backend", 22 | "url": "https://github.com/tks18/gindex-v4/tree/master/backend", 23 | "releases": { 24 | "production": { 25 | "tag": "backend-2.2.5", 26 | "version": "v2.2.5" 27 | }, 28 | "development": { 29 | "tag": "backend-2.2.5", 30 | "version": "v2.2.5" 31 | } 32 | } 33 | }, 34 | "clitool": { 35 | "location": "./cli-tool", 36 | "folder": "cli-tool", 37 | "name": "Cli Tool", 38 | "url": "https://github.com/tks18/gindex-v4/tree/master/cli-tool", 39 | "releases": { 40 | "production": { 41 | "tag": "cli-1.6.0", 42 | "version": "v1.6.0" 43 | }, 44 | "development": { 45 | "tag": "cli-1.6.0", 46 | "version": "v1.6.0" 47 | } 48 | } 49 | }, 50 | "versionmanager": { 51 | "location": "./version-manager", 52 | "folder": "version-manager", 53 | "name": "Version Manager", 54 | "url": "https://github.com/tks18/gindex-v4/tree/master/version-manager", 55 | "releases": { 56 | "production": { 57 | "tag": "version-manager-0.2.0", 58 | "version": "v0.2.0" 59 | }, 60 | "development": { 61 | "tag": "version-manager-0.1.0.100", 62 | "version": "v0.1.0.100" 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /vetur.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | settings: { 3 | 'vetur.useWorkspaceDependencies': true, 4 | 'vetur.experimental.templateInterpolationService': false, 5 | }, 6 | projects: [ 7 | { 8 | root: './vuejs', 9 | package: './package.json', 10 | snippetFolder: './vuejs/.vscode/vetur/snippets', 11 | globalComponents: ['./vuejs/src/components/**/*.vue'], 12 | }, 13 | ], 14 | }; 15 | -------------------------------------------------------------------------------- /vuejs/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead -------------------------------------------------------------------------------- /vuejs/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "plugin:vue/base", 8 | "plugin:vue/essential", 9 | "plugin:vue/recommended", 10 | "plugin:vue/strongly-recommended", 11 | "eslint:recommended", 12 | "airbnb", 13 | "google", 14 | "standard" 15 | ], 16 | "parser": "vue-eslint-parser", 17 | "parserOptions": { 18 | "parser": "@babel/eslint-parser", 19 | "ecmaVersion": 2021, 20 | "sourceType": "module" 21 | }, 22 | "plugins": ["vue"], 23 | "rules": { 24 | "require-jsdoc": "off", 25 | "valid-jsdoc": "off", 26 | "vue/html-indent": "off", 27 | "semi": "off", 28 | "space-before-function-paren": "off", 29 | "vue/max-attributes-per-line": "off", 30 | "vue/singleline-html-element-content-newline": "off", 31 | "no-unmodified-loop-condition": "off", 32 | "object-curly-spacing": "off", 33 | "template-curly-spacing": "off", 34 | "linebreak-style": "off", 35 | "no-undef": "off", 36 | "camelcase": "off", 37 | "indent": "off", 38 | "max-len": "off", 39 | "operator-linebreak": "off", 40 | "comma-dangle": "off", 41 | "quotes": "off", 42 | "no-restricted-syntax": "off", 43 | "vue/html-self-closing": "off", 44 | "no-restricted-globals": "off", 45 | "import/no-dynamic-require": "off", 46 | "newline-per-chained-call": "off", 47 | "guard-for-in": "off", 48 | "no-await-in-loop": "off", 49 | "import/no-unresolved": "off", 50 | "no-plusplus": "off" 51 | }, 52 | "overrides": [ 53 | { 54 | "files": [ 55 | "**/__tests__/*.{j,t}s?(x)", 56 | "**/tests/unit/**/*.spec.{j,t}s?(x)" 57 | ], 58 | "env": { 59 | "jest": true 60 | } 61 | }, 62 | { 63 | "files": [ 64 | "**/__tests__/*.{j,t}s?(x)", 65 | "**/tests/unit/**/*.spec.{j,t}s?(x)" 66 | ], 67 | "env": { 68 | "jest": true 69 | } 70 | } 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /vuejs/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | dist 4 | 5 | # yarn files 6 | !.yarn/* 7 | .yarn/cache 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/sdks 12 | !.yarn/versions 13 | 14 | # local env files 15 | .env 16 | .env.* 17 | .env.local 18 | .env.*.local 19 | 20 | # Log files 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | pnpm-debug.log* 25 | 26 | # Editor directories and files 27 | .idea 28 | .vscode/* 29 | !.vscode/launch.json 30 | !.vscode/tasks.json 31 | !.vscode/settings.json 32 | !.vscode/vetur 33 | !.vscode/*.code-snippets 34 | *.suo 35 | *.ntvs* 36 | *.njsproj 37 | *.sln 38 | *.sw? 39 | 40 | # Ignore test-related files 41 | /coverage.data 42 | /coverage/ -------------------------------------------------------------------------------- /vuejs/.yarn/build-state.yml: -------------------------------------------------------------------------------- 1 | # Warning: This file is automatically generated. Removing it is fine, but will 2 | # cause all your builds to become invalidated. 3 | 4 | # core-js-pure@npm:3.15.0 5 | "9b80393e57b60de7129423ce646634395feb1af895868ec782685e85da3a0384b803693cdba172ba94c7ea8010d596df58cf09e2d61e20bbefad496afdb81879": 6 | 30fb5f52ef609c99372c82b0f1e7281a02d901a738f8db97a689c12289bdb041c718dc00118e9c8d98254c5e98278d0c61955bd682416d9c7a35a7dd3a36cbf5 7 | 8 | # core-js@npm:2.6.12 9 | "0b93d77d31629ea22008e81fc0f5432252f9d8d4985cb82c4253a1aa05054d1dc0f9f59daf4668987876afb8a8adc93e90748dfdcc90cd8312236b6ebc616a70": 10 | 6ae5203729872bc3368b4d27994462ed6351cd8b32ab8507975a41784aa15368fedd03936a9f37b40dfc3735d4ad6c42a6950b7ac5356a0fe8a452522010ecab 11 | 12 | # core-js@npm:3.15.0 13 | "6abc42efa11e1fab751e36b2e6e725f9e3cc72c2d0af3ae4d4cc43deed45ab217ad918f7f07fc35f3a4b4e9f2a9ebe83501c44dabbd9f7e243ce2339bb4c5991": 14 | 173d1e8d68220aae15daf1f07b46ae2be632eee14d93e05c9e7511768cbba9bdb2b796acbe8454229a7c73a3a1b3b2cc527682c5cee28017b1e8458421fc653b 15 | 16 | # ejs@npm:2.7.4 17 | "879ed38a4e6f542ab08c36367888dd2c675bef03e81327d75da644a9795ff2d91c34d3cc00a725a6332b56c51ff7cd6a6c5e8c9f9411e6c41bf42b356e1e2417": 18 | 4e2ed2a8005a2e09e2a4026d8c0b6bf1e76a0be5e38fb6d9be139681cb52d24dc9944ee046f531beaff7bcaad1ff9f2e2c15734538d0410da61ebabf1b7e39b3 19 | 20 | # fibers@npm:5.0.0 21 | "aa74f08ddb9b7c4ebef69a52ac27320026e47481bcb101262734865d04b6dd8ad5ad602bd649ae7bf8135c4d596b57658c811fb7a8cf4d3ecc444dd9a68e1789": 22 | e38f196e865021a3405195613b2289ae2525117491e2355eb44ef3d2167fa56555ea03d525013916a23ca480f38f77b7a1c17ee01ad5115cf5ece134fdaa82fc 23 | 24 | # javascript-obfuscator@npm:2.15.2 25 | "95a480448acb88f1ace2b293d69ba9cead97ec55d607877dd89d5f9d1db0fb7721482e9836af67ad1bbbbe8a12c69753dbd8fd3e965e99d2aab3d5c2784746d3": 26 | b2a5ca79c2be9f7d88ef4515c92c2db4b061a00fa25f1a77872395fe474f1a5794935b408ea15acd50a2df1abe65f59da1730db518b678c076bce8543cba3937 27 | 28 | # node-sass@npm:6.0.0 29 | "7b9729adf36414b5e0c1e37ae00ee4a918b65b808740b7a5d9cef11829f06bc38655a2099625ce54f1de31b01e4dc01492ad145aee250b63b3f70080fe55dcfc": 30 | 06b56ee4256510295433650a10b7cabf4657c68ac41aa3ecd9ec251289cc979d11c9572bff1fb6348975630ada5dbdddf25240f2ffd35d0429610f948794573a 31 | 32 | # yorkie@npm:2.0.0 33 | "90a2c44491603d8abc64958df6cb3953fed067e47c862d5de6bfa981036615c4ca5f9a35456b35547d446eaa0a7ca942052f034a125463af0d56b74101a96fe3": 34 | b583a1308c577808c21a02aeabafa908058116a7b517c37acf858844d49b832920baaab9961aaf33e00a23fc8ba59fbbfa5ab85805d365fb3658e1924aaf2076 35 | -------------------------------------------------------------------------------- /vuejs/.yarn/install-state.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/.yarn/install-state.gz -------------------------------------------------------------------------------- /vuejs/.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | 3 | plugins: 4 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs 5 | spec: "@yarnpkg/plugin-interactive-tools" 6 | 7 | yarnPath: .yarn/releases/yarn-berry.js 8 | -------------------------------------------------------------------------------- /vuejs/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Shantk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vuejs/README.md: -------------------------------------------------------------------------------- 1 | # G Index based on Vue -------------------------------------------------------------------------------- /vuejs/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | [ 5 | '@babel/preset-env', 6 | { 7 | bugfixes: true, 8 | modules: false, 9 | targets: 'last 2 versions', 10 | }, 11 | ], 12 | ], 13 | env: { 14 | test: { 15 | plugins: ['@babel/plugin-transform-modules-commonjs'], 16 | }, 17 | }, 18 | plugins: ['@babel/plugin-syntax-dynamic-import'], 19 | }; 20 | -------------------------------------------------------------------------------- /vuejs/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "baseUrl": "." 6 | }, 7 | "typeAcquisition": { 8 | "exclude": [ 9 | "agent-base", 10 | "dotenv", 11 | "https-proxy-agent", 12 | "html-entities", 13 | "socks-proxy-agent", 14 | "source-map", 15 | "tsconfig-paths" 16 | ] 17 | }, 18 | "exclude": ["node_modules", "dist"], 19 | "include": ["src/**/*"] 20 | } 21 | -------------------------------------------------------------------------------- /vuejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gindex-v4", 3 | "version": "8.4.6", 4 | "license": "MIT", 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "win-build-theme": "scripts/windows/build-theme.bat", 9 | "win-build-all": "scripts/windows/buildAll.bat", 10 | "win-serve-theme": "scripts/windows/serve-theme.bat", 11 | "sh-build-theme": "bash scripts/others/build-theme.sh", 12 | "sh-build-all": "bash scripts/others/buildAll.sh", 13 | "sh-serve-theme": "bash scripts/others/serve-theme.sh", 14 | "lint": "vue-cli-service lint" 15 | }, 16 | "dependencies": { 17 | "aplayer": "^1.10.1", 18 | "axios": "^0.19.2", 19 | "bulma": "^0.9.0", 20 | "bulma-divider": "^0.2.0", 21 | "bulma-extensions": "^6.2.7", 22 | "clipboard": "^2.0.6", 23 | "cool-checkboxes-for-bulma.io": "^1.1.0", 24 | "core-js": "^3.6.4", 25 | "crypto-js": "^4.0.0", 26 | "element-ui": "^2.13.1", 27 | "feb-alive": "^1.0.9", 28 | "js-base64": "^3.6.1", 29 | "lodash": "^4.17.19", 30 | "marked": "^1.1.0", 31 | "nprogress": "^0.2.0", 32 | "sass": "1.32.8", 33 | "v-tooltip": "^2.0.3", 34 | "v-viewer": "^1.5.1", 35 | "vue": "^2.6.11", 36 | "vue-axios": "^2.1.5", 37 | "vue-clipboard2": "^0.3.1", 38 | "vue-codemirror": "^4.0.6", 39 | "vue-infinite-loading": "^2.4.5", 40 | "vue-infinite-scroll": "^2.0.2", 41 | "vue-lazyload": "^1.3.3", 42 | "vue-loading-overlay": "^3.3.2", 43 | "vue-meta": "^2.4.0", 44 | "vue-moment": "^4.1.0", 45 | "vue-notification": "^1.3.20", 46 | "vue-plyr": "6.0.4", 47 | "vue-router": "^3.3.4", 48 | "vue-select": "^3.10.7", 49 | "vue2-animate": "^2.1.3" 50 | }, 51 | "devDependencies": { 52 | "@babel/core": "^7.14.6", 53 | "@babel/eslint-parser": "^7.14.5", 54 | "@babel/plugin-transform-modules-commonjs": "^7.14.5", 55 | "@babel/preset-env": "^7.14.5", 56 | "@vue/cli-plugin-babel": "~4.4.5", 57 | "@vue/cli-plugin-eslint": "~4.4.5", 58 | "@vue/cli-service": "~4.4.5", 59 | "babel-core": "^6.26.3", 60 | "babel-eslint": "^10.1.0", 61 | "babel-loader": "^8.2.2", 62 | "babel-plugin-component": "^1.1.1", 63 | "babel-plugin-lodash": "^3.3.4", 64 | "browserslist": "^4.16.6", 65 | "caniuse-lite": "^1.0.30001239", 66 | "compression-webpack-plugin": "^4.0.0", 67 | "css-minimizer-webpack-plugin": "1.2.0", 68 | "deepmerge": "4.2.2", 69 | "eslint": "^7.29.0", 70 | "eslint-config-airbnb": "^18.2.1", 71 | "eslint-config-google": "^0.14.0", 72 | "eslint-config-standard": "^16.0.3", 73 | "eslint-plugin-import": "^2.23.4", 74 | "eslint-plugin-jsx-a11y": "^6.4.1", 75 | "eslint-plugin-node": "^11.1.0", 76 | "eslint-plugin-promise": "^5.1.0", 77 | "eslint-plugin-react": "^7.24.0", 78 | "eslint-plugin-vue": "^7.11.1", 79 | "fibers": "5.0.0", 80 | "fs": "0.0.1-security", 81 | "html-minimizer-webpack-plugin": "^3.1.0", 82 | "html-webpack-plugin": "^5.3.1", 83 | "javascript-obfuscator": "^2.15.2", 84 | "lodash-webpack-plugin": "^0.11.6", 85 | "node-sass": "^6.0.0", 86 | "prettier": "^2.3.1", 87 | "sass-loader": "8.0.2", 88 | "vue-eslint-parser": "^7.6.0", 89 | "vue-template-compiler": "^2.6.14", 90 | "webpack-obfuscator": "2.6.0" 91 | }, 92 | "releases": { 93 | "production": "frontend-8.4.6", 94 | "development": "frontend-8.4.6.100" 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /vuejs/public/images/airplane.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/airplane.gif -------------------------------------------------------------------------------- /vuejs/public/images/baidu-pan-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/baidu-pan-logo.png -------------------------------------------------------------------------------- /vuejs/public/images/eyes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/eyes.png -------------------------------------------------------------------------------- /vuejs/public/images/g-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/g-logo.png -------------------------------------------------------------------------------- /vuejs/public/images/no-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/no-data.png -------------------------------------------------------------------------------- /vuejs/public/images/player/aria2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/aria2.png -------------------------------------------------------------------------------- /vuejs/public/images/player/iina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/iina.png -------------------------------------------------------------------------------- /vuejs/public/images/player/mxplayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/mxplayer.png -------------------------------------------------------------------------------- /vuejs/public/images/player/nplayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/nplayer.png -------------------------------------------------------------------------------- /vuejs/public/images/player/potplayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/potplayer.png -------------------------------------------------------------------------------- /vuejs/public/images/player/thunder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/thunder.png -------------------------------------------------------------------------------- /vuejs/public/images/player/vlc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tks18/gindex-v4/cff5db26d172af4eb87fd29042961f250e52b56f/vuejs/public/images/player/vlc.png -------------------------------------------------------------------------------- /vuejs/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <% for (var i in 10 | htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %> 11 | 16 | 17 | 21 | <% } %> 22 | <%= htmlWebpackPlugin.options.title %> 23 | 86 | 87 | <% for (var i in 88 | htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> 89 | 90 | <% } %> 91 | 92 | 93 | 94 |
95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /vuejs/rules.md: -------------------------------------------------------------------------------- 1 | ### Top Bar 2 | .navbar.is-dark{background-color:#3a3c40;color:#fff} 3 | 4 | ### Hover Selection Table Span 5 | tr:not(.is-selected):hover{background-color:#585b62;color: #ffffff} 6 | 7 | ### Hover Table Individual Selection 8 | .table td .icon,.table td:hover{cursor:pointer;background-color:#3D4149;color: #ffffff} 9 | 10 | ### TAble Body 11 | .table{background-color:#3d4149;color:#ffffff} 12 | 13 | ### Drive Dropdown 14 | .navbar-dropdown{border-radius:6px;border-top:none;box-shadow:0 8px 8px rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.1);display:block;opacity:0;pointer-events:none;top:calc(100% + -4px);transform:translateY(-5px);transition-duration:86ms;transition-property:opacity,transform} 15 | 16 | ### Lnguage Already Selected 17 | .navbar.is-dark .navbar-dropdown a.navbar-item.is-active{background-color:#363636;color:#fff} 18 | 19 | ### Dropdown Background 20 | .navbar-dropdown{background-color:#3d4149;border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top:2px solid #f53304;box-shadow:0 8px 8px rgba(10,10,10,.1);display:none;font-size:.875rem;left:0;min-width:100%;position:absolute;top:100%;z-index:20} 21 | 22 | ### Dropdown Focus 23 | .navbar-dropdown a.navbar-item:focus,.navbar-dropdown a.navbar-item:hover{background-color:#585b62;color:#020101ef} 24 | 25 | ### Dropdown Text Color Default 26 | .navbar-item,.navbar-link{color:#ffffff;display:block;line-height:1.5;padding:.5rem .75rem;position:relative} 27 | 28 | 29 | ### Navigation Hover 30 | a.navbar-item:hover{background-color:#000;color:#fff} 31 | 32 | a.navbar-item:hover{background-color:#ff3434;color:#fff} 33 | 34 | ------------------------------ 35 | 36 | ### Clear Cache Notification Box 37 | .el-notification{display:flex;width:330px;padding:14px 26px 14px 13px;border-radius:8px;box-sizing:border-box;border:1px solid #3D4149;position:fixed;background-color:#3D4149;box-shadow:0 2px 12px 0 rgba(0,0,0,.1);transition:opacity .3s,transform .3s,left .3s,right .3s,top .4s,bottom .3s;overflow:hidden} 38 | 39 | ### Title 40 | .el-notification__title{font-weight:700;font-size:16px;color:#ffffff;margin:0} 41 | 42 | ### Content 43 | .el-notification__content{font-size:14px;line-height:21px;margin:6px 0 0;color:#dddddd;text-align:justify} 44 | 45 | ### Success Icon 46 | .el-icon-success{color:#67c23a} 47 | 48 | 49 | 50 | 51 | ### Loading Mask 52 | .el-loading-mask{position:absolute;z-index:2000;background-color:#f3f4f76e;margin:0;top:0;right:0;bottom:0;left:0;transition:opacity .3s} 53 | 54 | 55 | 56 | 57 | 58 | ------------------------- 59 | 60 | index.js 61 | app.js 62 | goindex.glitch.me -------------------------------------------------------------------------------- /vuejs/scripts/others/build-theme.sh: -------------------------------------------------------------------------------- 1 | printf "\n" 2 | printf "U L T I M A T E G - I N D E X T H E M E B U I L D E R" 3 | printf "\n" 4 | printf "\n" 5 | printf "\n" 6 | printf "Please Ensure Correct CDN in the .env" 7 | printf "\n" 8 | printf "Starting the Script Now." 9 | printf "\n" 10 | printf "Currently Following Themes are Available:" 11 | themes=("carnation" "curious-blue" "emerald" "ice-cold" "konifer" "netflix-red" "kournikova" "mona-lisa" "persian-rose" "purple-heart" "purple-mountains-majesty" "salmon" "selective-yellow" "shamrock" "witch-haze") 12 | i=0 13 | for theme in ${themes[@]}; do 14 | i=i+1 15 | printf "${i}. ${theme}" 16 | done 17 | read -p 'Enter theme name as Above(Case Sensitive): ' setTheme 18 | printf "\n" 19 | rm -rf outputs/${setTheme}/* 20 | mkdir -p outputs\${setTheme} 21 | export VUE_APP_THEME=${setTheme} 22 | printf "Currently Building for ${setTheme}" 23 | printf "\n" 24 | yarn build 25 | cp -r dist/. outputs/${setTheme}/. 26 | -------------------------------------------------------------------------------- /vuejs/scripts/others/buildAll.sh: -------------------------------------------------------------------------------- 1 | printf "\n" 2 | printf "U L T I M A T E G - I N D E X T H E M E B U I L D E R" 3 | printf "\n" 4 | printf "\n" 5 | printf "\n" 6 | printf "Please Ensure Correct CDN in the .env" 7 | printf "\n" 8 | printf "Starting the Script Now." 9 | printf "\n" 10 | printf "Currently Building for Following Themes:" 11 | themes=("carnation" "curious-blue" "emerald" "ice-cold" "konifer" "netflix-red" "kournikova" "mona-lisa" "persian-rose" "purple-heart" "purple-mountains-majesty" "salmon" "selective-yellow" "shamrock" "witch-haze") 12 | i=0 13 | for theme in ${themes[@]}; do 14 | i=i+1 15 | printf "${i}. ${theme}" 16 | done 17 | for theme in ${themes[@]}; do 18 | printf "\n" 19 | rm -rf outputs/* 20 | export VUE_APP_THEME=${theme} 21 | printf "Currently Building for ${theme}" 22 | printf "\n" 23 | yarn build 24 | cp -r dist/. outputs/${theme}/. 25 | done 26 | printf "\n" 27 | printf "Built Assets for Every Theme. Please find the Themes in Outputs Folder" 28 | -------------------------------------------------------------------------------- /vuejs/scripts/others/serve-theme.sh: -------------------------------------------------------------------------------- 1 | printf "\n" 2 | printf "U L T I M A T E G - I N D E X T H E M E B U I L D E R" 3 | printf "\n" 4 | printf "\n" 5 | printf "\n" 6 | printf "Please Ensure Correct CDN in the .env" 7 | printf "\n" 8 | printf "Starting the Script Now." 9 | printf "\n" 10 | printf "Currently Building for Following Themes:" 11 | themes=("carnation" "curious-blue" "emerald" "ice-cold" "konifer" "netflix-red" "kournikova" "mona-lisa" "persian-rose" "purple-heart" "purple-mountains-majesty" "salmon" "selective-yellow" "shamrock" "witch-haze") 12 | for theme in ${themes[@]}; do 13 | i=i+1 14 | printf "${i}. ${theme}" 15 | done 16 | read -p 'Enter theme name as Above(Case Sensitive): ' setTheme 17 | printf "\n" 18 | export VUE_APP_THEME=${setTheme} 19 | printf "Currently Serving for ${setTheme}" 20 | printf 21 | yarn serve 22 | -------------------------------------------------------------------------------- /vuejs/scripts/windows/build-theme.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo U L T I M A T E G ^- I N D E X T H E M E B U I L D E R 4 | echo. 5 | echo by 6 | echo. ______ __ __ 7 | echo. / __/ / ___ ____ / /_/ /__ 8 | echo. _\ \/ _ \/ _ `/ _ \ / __/ '_/ 9 | echo. /___/_//_/\_,_/_//_/ \__/_/\_\ 10 | echo. 11 | echo. 12 | echo Please Ensure Correct CDN in the .env. 13 | echo. 14 | echo Starting the Script Now. 15 | echo. 16 | echo Currently Following Themes are Available: 17 | set themes=carnation curious^-blue emerald ice^-cold konifer netflix^-red kournikova mona^-lisa persian^-rose purple^-heart purple^-mountains^-majesty salmon selective^-yellow shamrock witch^-haze 18 | for %%b in (%themes%) do ( 19 | set /A i+=1 20 | echo %i%. %%b 21 | ) 22 | set /p theme=Enter theme name as Above(Case Sensitive): 23 | echo. 24 | rmdir outputs\%theme% /s /Q 25 | set VUE_APP_THEME=%theme% 26 | echo Currently Building for %theme% 27 | echo. 28 | CALL yarn build 29 | CALL robocopy "dist" "outputs/%theme%" /E 30 | -------------------------------------------------------------------------------- /vuejs/scripts/windows/buildAll.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo U L T I M A T E G ^- I N D E X T H E M E B U I L D E R 4 | echo. 5 | echo by 6 | echo. ______ __ __ 7 | echo. / __/ / ___ ____ / /_/ /__ 8 | echo. _\ \/ _ \/ _ `/ _ \ / __/ '_/ 9 | echo. /___/_//_/\_,_/_//_/ \__/_/\_\ 10 | echo. 11 | echo. 12 | echo Building all theme Assets. 13 | echo. 14 | echo Please Ensure Correct CDN in the .env. 15 | echo. 16 | echo Starting the Script Now. 17 | echo. 18 | echo Currently Building for Following Themes: 19 | set themes=carnation curious^-blue emerald ice^-cold konifer netflix^-red kournikova mona^-lisa persian^-rose purple^-heart purple^-mountains^-majesty salmon selective^-yellow shamrock witch^-haze 20 | for %%b in (%themes%) do ( 21 | set /A i+=1 22 | echo %i%. %%b 23 | ) 24 | for %%a in (%themes%) do ( 25 | @echo off 26 | echo. 27 | rmdir outputs\%%a /s /Q 28 | set VUE_APP_THEME=%%a 29 | echo Currently Building for %%a 30 | echo. 31 | yarn build 32 | robocopy "dist" "outputs/%%a" /E 33 | ) 34 | echo. 35 | echo Built Assets for Every Theme. Please find the Themes in Outputs Folder. 36 | exit 37 | -------------------------------------------------------------------------------- /vuejs/scripts/windows/serve-theme.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo U L T I M A T E G ^- I N D E X T H E M E B U I L D E R 4 | echo. 5 | echo by 6 | echo. ______ __ __ 7 | echo. / __/ / ___ ____ / /_/ /__ 8 | echo. _\ \/ _ \/ _ `/ _ \ / __/ '_/ 9 | echo. /___/_//_/\_,_/_//_/ \__/_/\_\ 10 | echo. 11 | echo. 12 | echo Starting the Script Now. 13 | echo. 14 | echo Currently Following Themes are Available: 15 | set themes=carnation curious^-blue emerald ice^-cold konifer netflix^-red kournikova mona^-lisa persian^-rose purple^-heart purple^-mountains^-majesty salmon selective^-yellow shamrock witch^-haze 16 | for %%b in (%themes%) do ( 17 | set /A i+=1 18 | echo %i%. %%b 19 | ) 20 | set /p theme=Enter theme name as Above(Case Sensitive): 21 | echo. 22 | set VUE_APP_THEME=%theme% 23 | echo Currently Building for %theme% 24 | echo. 25 | yarn serve 26 | exit 27 | -------------------------------------------------------------------------------- /vuejs/src/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 126 | -------------------------------------------------------------------------------- /vuejs/src/components/BreadCrumb.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 114 | 137 | -------------------------------------------------------------------------------- /vuejs/src/components/Footer.vue: -------------------------------------------------------------------------------- 1 | 50 | 83 | -------------------------------------------------------------------------------- /vuejs/src/components/Markdown.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 50 | -------------------------------------------------------------------------------- /vuejs/src/components/notification.js: -------------------------------------------------------------------------------- 1 | import { Notification } from 'element-ui'; 2 | 3 | const notify = ({ title, message, type, duration }) => { 4 | Notification({ 5 | title, 6 | message, 7 | type, 8 | duration: duration || 2500, 9 | }); 10 | }; 11 | 12 | export default notify; 13 | -------------------------------------------------------------------------------- /vuejs/src/components/viewmode.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 27 | -------------------------------------------------------------------------------- /vuejs/src/libs/util.cdn.js: -------------------------------------------------------------------------------- 1 | export default function cdnpath(path) { 2 | const cdn = process.env.VUE_APP_CDN_PATH; 3 | if (process.env.NODE_ENV === 'production') { 4 | return cdn + path; 5 | } 6 | return path; 7 | } 8 | -------------------------------------------------------------------------------- /vuejs/src/libs/util.import.development.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable global-require */ 2 | 3 | module.exports = (file) => require(`@/views/${file}`).default; 4 | -------------------------------------------------------------------------------- /vuejs/src/libs/util.import.production.js: -------------------------------------------------------------------------------- 1 | module.exports = (file) => () => import(`@/views/${file}`); 2 | -------------------------------------------------------------------------------- /vuejs/src/main.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | import Vue from 'vue'; 3 | import { Loading } from 'element-ui'; 4 | import 'element-ui/lib/theme-chalk/icon.css'; 5 | import 'element-ui/lib/theme-chalk/notification.css'; 6 | import 'element-ui/lib/theme-chalk/loading.css'; 7 | import notification from '@/components/notification'; 8 | import axios from '@/plugin/axios'; 9 | import rawAxios from 'axios'; 10 | import VueAxios from 'vue-axios'; 11 | import vSelect from 'vue-select'; 12 | import Vclipboard2 from 'vue-clipboard2'; 13 | import VueLazyload from 'vue-lazyload'; 14 | import VTooltip from 'v-tooltip'; 15 | import Viewer from 'v-viewer'; 16 | import Meta from 'vue-meta'; 17 | import VuePlyr from 'vue-plyr'; 18 | import App from './App.vue'; 19 | import cdnpath from './libs/util.cdn'; 20 | import { createPlayer, globalPlayer, destroyPlayer } from './plugin/aplayer'; 21 | import router from './router'; 22 | import loadTheme from './themeManager'; 23 | import 'viewerjs/dist/viewer.css'; 24 | import 'vue-loading-overlay/dist/vue-loading.css'; 25 | 26 | Vue.config.productionTip = false; 27 | Vue.prototype.$currentTheme = loadTheme(); 28 | Vue.prototype.$cdnpath = cdnpath; 29 | Vue.prototype.$backend = rawAxios; 30 | Vue.prototype.$notify = notification; 31 | Vue.prototype.$bus = new Vue({}); 32 | Vue.prototype.$audio = { 33 | createPlayer, 34 | player: globalPlayer, 35 | destroy: destroyPlayer, 36 | }; 37 | Vue.use(VuePlyr, { 38 | invertTime: false, 39 | settings: ['quality', 'speed', 'loop', 'captions'], 40 | controls: [ 41 | 'play-large', 42 | 'restart', 43 | 'play', 44 | 'progress', 45 | 'current-time', 46 | 'duration', 47 | 'mute', 48 | 'volume', 49 | 'captions', 50 | 'settings', 51 | 'pip', 52 | 'airplay', 53 | 'fullscreen', 54 | ], 55 | }); 56 | Vue.use(Loading); 57 | Vue.use(VTooltip); 58 | Vue.use(VueAxios, axios); 59 | Vue.use(Meta); 60 | Vclipboard2.config.autoSetContainer = true; 61 | Vue.use(Vclipboard2); 62 | Vue.component('VSelect', vSelect); 63 | Vue.use(require('vue-moment')); 64 | 65 | Vue.use(VueLazyload, { 66 | loading: 67 | 'https://i.pinimg.com/originals/4d/a1/a6/4da1a6911fdbc6f21fdd14d2140b2d61.gif', 68 | lazyComponent: true, 69 | }); 70 | Vue.use(Viewer); 71 | 72 | new Vue({ 73 | router, 74 | render: (h) => h(App), 75 | }).$mount('#app'); 76 | -------------------------------------------------------------------------------- /vuejs/src/plugin/aplayer/index.js: -------------------------------------------------------------------------------- 1 | import 'aplayer/dist/APlayer.min.css'; 2 | import Aplayer from 'aplayer'; 3 | 4 | let dynplayer; 5 | let domElement; 6 | export function createPlayer() { 7 | domElement = document.createElement('div'); 8 | document.body.appendChild(domElement); 9 | dynplayer = new Aplayer({ 10 | container: domElement, 11 | fixed: true, 12 | loop: 'all', 13 | theme: '#e50914', 14 | preload: 'auto', 15 | volume: 0.7, 16 | }); 17 | } 18 | export function globalPlayer() { 19 | if (dynplayer === undefined || dynplayer === '') return undefined; 20 | return dynplayer; 21 | } 22 | 23 | export function destroyPlayer() { 24 | if (dynplayer) { 25 | dynplayer.destroy(); 26 | dynplayer = ''; 27 | domElement.remove(); 28 | domElement = ''; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vuejs/src/plugin/axios/index.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import notify from '@/components/notification'; 3 | import router from '@/router'; 4 | 5 | const service = axios.create({ 6 | baseURL: process.env.VUE_APP_API ? process.env.VUE_APP_API : '', 7 | }); 8 | 9 | service.interceptors.request.use( 10 | (config) => config, 11 | (error) => Promise.reject(error), 12 | ); 13 | 14 | service.interceptors.response.use( 15 | (response) => response, 16 | (error) => { 17 | if (error && error.response) { 18 | if (error.response.status === 500) { 19 | router.go(); 20 | } else if (error.response.status === 401) { 21 | const errorResp = error; 22 | errorResp.message = "You Don't Deserve this Glory!! 😝"; 23 | notify({ 24 | title: 'Error While Making Request', 25 | message: error.message, 26 | type: 'error', 27 | duration: 5 * 1000, 28 | }); 29 | } 30 | } 31 | return Promise.reject(errorResp); 32 | }, 33 | ); 34 | 35 | export default service; 36 | -------------------------------------------------------------------------------- /vuejs/src/styles/carnation/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #fa4659; 10 | $accent: #fa4659; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #39263f; 14 | $grad-midtwo: #75325e; 15 | $grad-midthree: #ba3768; 16 | $grad-final: #fa4659; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #fedadd; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/curious-blue/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #3498db; 10 | $accent: #3498db; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #2b2e3d; 14 | $grad-midtwo: #3d4d6e; 15 | $grad-midthree: #4471a4; 16 | $grad-final: #3498db; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #d6eaf7; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/emerald/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #00d42e; 10 | $accent: #00d42e; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #003a59; 14 | $grad-midtwo: #006f8e; 15 | $grad-midthree: #00a583; 16 | $grad-final: #00d42e; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #e5faea; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/ice-cold/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #a3f3eb; 10 | $accent: #a3f3eb; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #3a4049; 14 | $grad-midtwo: #5a7686; 15 | $grad-midthree: #79b3be; 16 | $grad-final: #a3f3eb; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #ecfcfb; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/konifer/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #85ef47; 10 | $accent: #85ef47; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #09415d; 14 | $grad-midtwo: #007d94; 15 | $grad-midthree: #00bb8d; 16 | $grad-final: #85ef47; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #e6fbda; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/kournikova/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #ffd571; 10 | $accent: #ffd571; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #4c3746; 14 | $grad-midtwo: #9a5c65; 15 | $grad-midthree: #de8e6c; 16 | $grad-final: #ffd571; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #fff6e2; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/mona-lisa/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #ff9999; 10 | $accent: #ff9999; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #3d3240; 14 | $grad-midtwo: #775269; 15 | $grad-midthree: #bb7387; 16 | $grad-final: #ff9999; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #ffeaea; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/netflix-red/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #e50914; 10 | $accent: #e50914; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #381f3c; 14 | $grad-midtwo: #761750; 15 | $grad-midthree: #b60044; 16 | $grad-final: #e50914; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: hsla(351, 100%, 96%, 0.95); 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/persian-rose/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #fa26a0; 10 | $accent: #fa26a0; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #342643; 14 | $grad-midtwo: #69346f; 15 | $grad-midthree: #ad3690; 16 | $grad-final: #fa26a0; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #fed3ec; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/purple-heart/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #851de0; 10 | $accent: #851de0; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #241f44; 14 | $grad-midtwo: #392778; 15 | $grad-midthree: #5a2aad; 16 | $grad-final: #851de0; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #e6d1f8; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/purple-mountains-majesty/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #a37eba; 10 | $accent: #a37eba; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #2f2c39; 14 | $grad-midtwo: #504662; 15 | $grad-midthree: #77628e; 16 | $grad-final: #a37eba; 17 | 18 | $button-text: white; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #ece5f1; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/salmon/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #ff7e67; 10 | $accent: #ff7e67; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #3d2d40; 14 | $grad-midtwo: #7c4361; 15 | $grad-midthree: #c25b6e; 16 | $grad-final: #ff7e67; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #ffe5e0; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/selective-yellow/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #ffb400; 10 | $accent: #ffb400; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #4d2e47; 14 | $grad-midtwo: #a1445b; 15 | $grad-midthree: #e76c48; 16 | $grad-final: #ffb400; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #fff0cc; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/shamrock/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #2ec1ac; 10 | $accent: #2ec1ac; 11 | 12 | $grad-start: #121212; 13 | $grad-midone: #2a3544; 14 | $grad-midtwo: #276076; 15 | $grad-midthree: #00909c; 16 | $grad-final: #2ec1ac; 17 | 18 | $button-text: black; 19 | $control-border-width: 2px; 20 | $input-border-color: transparent; 21 | $input-shadow: none; 22 | 23 | $table-row-hover-background-color: #d5f2ee; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/styles/witch-haze/register.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | // Import a Google Font 4 | @import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap'); 5 | 6 | $family-sans-serif: 'Open Sans', sans-serif; 7 | $widescreen-enabled: false; 8 | $fullhd-enabled: true; 9 | $link: #fff591; 10 | $accent: #fff591; 11 | 12 | $button-text: black; 13 | $control-border-width: 2px; 14 | $input-border-color: transparent; 15 | $input-shadow: none; 16 | 17 | $grad-start: #121212; 18 | $grad-midone: #513c49; 19 | $grad-midtwo: #a3686b; 20 | $grad-midthree: #e6a578; 21 | $grad-final: #fff591; 22 | 23 | $table-row-hover-background-color: #fffde9; 24 | 25 | @import 'bulma'; 26 | @import 'bulma-divider'; 27 | @import 'cool-checkboxes-for-bulma.io'; 28 | @import '~@/styles/base.scss'; 29 | @import 'vue2-animate/src/sass/vue2-animate.scss'; 30 | @import 'vue-select/src/scss/vue-select.scss'; 31 | @import 'bulma-extensions/bulma-switch/src/sass/index.sass'; 32 | -------------------------------------------------------------------------------- /vuejs/src/themeConfigs.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | name: 'kournikova', 4 | hex: '#ffd571', 5 | text: false, 6 | }, 7 | { 8 | name: 'shamrock', 9 | hex: '#2EC1AC', 10 | text: false, 11 | }, 12 | { 13 | name: 'carnation', 14 | hex: '#fa4659', 15 | text: true, 16 | }, 17 | { 18 | name: 'purple-mountains-majesty', 19 | hex: '#A37EBA', 20 | text: true, 21 | }, 22 | { 23 | name: 'persian-rose', 24 | hex: '#FA26A0', 25 | text: true, 26 | }, 27 | { 28 | name: 'selective-yellow', 29 | hex: '#ffb400', 30 | text: false, 31 | }, 32 | { 33 | name: 'netflix-red', 34 | hex: '#E50914', 35 | text: true, 36 | }, 37 | { 38 | name: 'purple-heart', 39 | hex: '#851DE0', 40 | text: false, 41 | }, 42 | { 43 | name: 'mona-lisa', 44 | hex: '#FF9999', 45 | text: false, 46 | }, 47 | { 48 | name: 'emerald', 49 | hex: '#00D42E', 50 | text: true, 51 | }, 52 | { 53 | name: 'ice-cold', 54 | hex: '#A3F3EB', 55 | text: false, 56 | }, 57 | { 58 | name: 'curious-blue', 59 | hex: '#3498DB', 60 | text: true, 61 | }, 62 | { 63 | name: 'witch-haze', 64 | hex: '#FFF591', 65 | text: false, 66 | }, 67 | { 68 | name: 'salmon', 69 | hex: '#FF7E67', 70 | text: false, 71 | }, 72 | { 73 | name: 'konifer', 74 | hex: '#85EF47', 75 | text: false, 76 | }, 77 | ]; 78 | -------------------------------------------------------------------------------- /vuejs/src/themeManager.js: -------------------------------------------------------------------------------- 1 | import themeConfigs from './themeConfigs'; 2 | 3 | const identifyTheme = (THEME) => { 4 | const defaultTheme = themeConfigs.filter( 5 | (theme) => theme.name === 'netflix-red', 6 | )[0]; 7 | if (THEME) { 8 | const currentTheme = themeConfigs.filter((theme) => theme.name === THEME); 9 | if (currentTheme.length > 0) { 10 | return currentTheme[0]; 11 | } 12 | } 13 | return defaultTheme; 14 | }; 15 | 16 | export default function returnTheme() { 17 | const themes = [ 18 | 'carnation', 19 | 'curious-blue', 20 | 'emerald', 21 | 'ice-cold', 22 | 'konifer', 23 | 'netflix-red', 24 | 'kournikova', 25 | 'mona-lisa', 26 | 'persian-rose', 27 | 'purple-heart', 28 | 'purple-mountains-majesty', 29 | 'salmon', 30 | 'selective-yellow', 31 | 'shamrock', 32 | 'witch-haze', 33 | ]; 34 | if (process.env.VUE_APP_THEME) { 35 | if (themes.includes(process.env.VUE_APP_THEME)) { 36 | import(`@/styles/${process.env.VUE_APP_THEME}/register.scss`); 37 | } else { 38 | import('@/styles/netflix-red/register.scss'); 39 | } 40 | } else { 41 | import('@/styles/netflix-red/register.scss'); 42 | } 43 | const themeConfig = identifyTheme(process.env.VUE_APP_THEME); 44 | return themeConfig; 45 | } 46 | -------------------------------------------------------------------------------- /vuejs/src/utils/backendUtils.js: -------------------------------------------------------------------------------- 1 | const backendBaseUrl = window.backend; 2 | 3 | export const apiRoutes = { 4 | checkEmail: `${backendBaseUrl}/checkmail`, 5 | loginRoute: `${backendBaseUrl}/login`, 6 | registerRoute: `${backendBaseUrl}/register/user`, 7 | otpRegister: `${backendBaseUrl}/register/approve/otp`, 8 | requestRoute: `${backendBaseUrl}/request/user`, 9 | verifyRoute: `${backendBaseUrl}/user/verify`, 10 | changePasswordRoute: `${backendBaseUrl}/user/changepassword`, 11 | requestadminroute: `${backendBaseUrl}/request/admin`, 12 | requestsuperadminroute: `${backendBaseUrl}/request/superadmin`, 13 | getPendingUsers: `${backendBaseUrl}/get/pending/users`, 14 | getPendingAdmins: `${backendBaseUrl}/get/pending/admins`, 15 | getPendingSuperAdmins: `${backendBaseUrl}/get/pending/superadmins`, 16 | deletePendingUsers: `${backendBaseUrl}/request/remove/user`, 17 | deletePendingAdmins: `${backendBaseUrl}/request/remove/admin`, 18 | deletePendingSuperAdmins: `${backendBaseUrl}/request/remove/superadmin`, 19 | upgradeAdmin: `${backendBaseUrl}/register/approve/admin`, 20 | upgradeSuperAdmin: `${backendBaseUrl}/register/approve/superadmin`, 21 | inviteUser: `${backendBaseUrl}/invite/user`, 22 | inviteAdmin: `${backendBaseUrl}/invite/admin`, 23 | inviteSuperAdmin: `${backendBaseUrl}/invite/superadmin`, 24 | addSpamUser: `${backendBaseUrl}/spam/user`, 25 | quickaddSpam: `${backendBaseUrl}/spam/quickadd`, 26 | addSpamAdmin: `${backendBaseUrl}/spam/admin`, 27 | addSpamSuperAdmin: `${backendBaseUrl}/spam/superadmin`, 28 | removeSpamUser: `${backendBaseUrl}/spam/remove/user`, 29 | removeSpamAdmin: `${backendBaseUrl}/spam/remove/admin`, 30 | removeSpamSuperadmin: `${backendBaseUrl}/spam/remove/superadmin`, 31 | getSpamUsers: `${backendBaseUrl}/get/spam/users`, 32 | getSpamAdmins: `${backendBaseUrl}/get/spam/admins`, 33 | getSpamSuperadmins: `${backendBaseUrl}/get/spam/superadmins`, 34 | deleteUser: `${backendBaseUrl}/delete/user`, 35 | deleteMe: `${backendBaseUrl}/user/delete`, 36 | deleteAdmin: `${backendBaseUrl}/delete/admin`, 37 | mediaTokenTransmitter: `${backendBaseUrl}/media/generate`, 38 | mediaTokenVerify: `${backendBaseUrl}/media/verify`, 39 | getUsers: `${backendBaseUrl}/get/users`, 40 | forgotPass: `${backendBaseUrl}/user/forgotpass`, 41 | getAll: `${backendBaseUrl}/get/all`, 42 | getAdmins: `${backendBaseUrl}/get/admins`, 43 | getSuperAdmins: `${backendBaseUrl}/get/superadmins`, 44 | setSiteSettings: `${backendBaseUrl}/settings/set`, 45 | getSiteSettings: `${backendBaseUrl}/settings/get`, 46 | getallPosters: `${backendBaseUrl}/posters/all`, 47 | getCatPosters: `${backendBaseUrl}/posters/categories/get`, 48 | gettrendPosters: `${backendBaseUrl}/posters/trending/get`, 49 | getheroPosters: `${backendBaseUrl}/posters/hero/get`, 50 | getquickLinks: `${backendBaseUrl}/posters/quicklinks/get`, 51 | setCatPosters: `${backendBaseUrl}/posters/categories/set`, 52 | settrendPosters: `${backendBaseUrl}/posters/trending/set`, 53 | setheroPosters: `${backendBaseUrl}/posters/hero/set`, 54 | setquickLinks: `${backendBaseUrl}/posters/quicklinks/set`, 55 | deleteCatPosters: `${backendBaseUrl}/posters/categories/delete`, 56 | deletetrendPosters: `${backendBaseUrl}/posters/trending/delete`, 57 | deleteheroPosters: `${backendBaseUrl}/posters/hero/delete`, 58 | deletequickLinks: `${backendBaseUrl}/posters/quicklinks/delete`, 59 | getMediaData: `${backendBaseUrl}/media/data`, 60 | }; 61 | 62 | export function backendHeaders(token) { 63 | return { 64 | headers: { 65 | token, 66 | }, 67 | }; 68 | } 69 | -------------------------------------------------------------------------------- /vuejs/src/utils/encryptUtils.js: -------------------------------------------------------------------------------- 1 | import crypto from 'crypto-js'; 2 | 3 | const secret = process.env.VUE_APP_SECRET_PASS; 4 | 5 | export function encodeSecret(object) { 6 | const hash = crypto.AES.encrypt(object, secret).toString(); 7 | return hash; 8 | } 9 | 10 | export function decodeSecret(hash) { 11 | const object = crypto.AES.decrypt(hash, secret).toString(crypto.enc.Utf8); 12 | return object; 13 | } 14 | 15 | export function getItem(name) { 16 | const object = localStorage.getItem(name); 17 | return object; 18 | } 19 | 20 | export function setItem(name, obj) { 21 | localStorage.setItem(name, obj); 22 | } 23 | 24 | export function removeItem(name) { 25 | localStorage.removeItem(name); 26 | } 27 | -------------------------------------------------------------------------------- /vuejs/src/utils/playUtils.js: -------------------------------------------------------------------------------- 1 | import cdnpath from '@/libs/util.cdn'; 2 | 3 | export const srt2vtt = (s) => { 4 | const convertedFile = `WEBVTT FILE\r\n\r\n${s 5 | .replace(/\{\\([ibu])\}/g, '') 6 | .replace(/\{\\([ibu])1\}/g, '<$1>') 7 | .replace(/\{([ibu])\}/g, '<$1>') 8 | .replace(/\{\/([ibu])\}/g, '') 9 | .replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g, '$1.$2') 10 | .concat('\r\n\r\n')}`; 11 | return convertedFile; 12 | }; 13 | 14 | export function players(url, title) { 15 | const playerList = [ 16 | { 17 | name: 'IINA', 18 | icon: cdnpath('images/player/iina.png'), 19 | scheme: `iina://weblink?url=${url}`, 20 | }, 21 | { 22 | name: 'PotPlayer', 23 | icon: cdnpath('images/player/potplayer.png'), 24 | scheme: `potplayer://${url}`, 25 | }, 26 | { 27 | name: 'VLC', 28 | icon: cdnpath('images/player/vlc.png'), 29 | scheme: `vlc://${url}`, 30 | }, 31 | { 32 | name: 'Cast2Tv', 33 | icon: 34 | 'https://assets.materialup.com/uploads/b8e5d402-cd36-4774-bf10-0985e993a33e/preview', 35 | scheme: `intent:${url}#Intent;package=com.instantbits.cast.webvideo;S.title=${title};end`, 36 | }, 37 | { 38 | name: 'Thunder', 39 | icon: cdnpath('images/player/thunder.png'), 40 | scheme: `thunder://${Buffer.from(`AA${url}ZZ`).toString('base64')}`, 41 | }, 42 | { 43 | name: 'nPlayer', 44 | icon: cdnpath('images/player/nplayer.png'), 45 | scheme: `nplayer-${url}`, 46 | }, 47 | { 48 | name: 'MXPlayer(Free)', 49 | icon: cdnpath('images/player/mxplayer.png'), 50 | scheme: `intent:${url}#Intent;package=com.mxtech.videoplayer.ad;S.title=${title};end`, 51 | }, 52 | { 53 | name: 'MXPlayer(Pro)', 54 | icon: cdnpath('images/player/mxplayer.png'), 55 | scheme: `intent:${url}#Intent;package=com.mxtech.videoplayer.pro;S.title=${title};end`, 56 | }, 57 | ]; 58 | return playerList; 59 | } 60 | -------------------------------------------------------------------------------- /vuejs/src/views/static/ResultPage.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 104 | -------------------------------------------------------------------------------- /vuejs/vue.config.js: -------------------------------------------------------------------------------- 1 | const { chainWebpack, devServer, cssOptions } = require('./webpack'); 2 | const webpackConfig = require('./webpack.config'); 3 | 4 | const localBuild = process.env.VUE_APP_LOCAL 5 | module.exports = { 6 | publicPath: localBuild ? '/' : process.env.VUE_APP_CDN_PATH || '/', 7 | runtimeCompiler: true, 8 | lintOnSave: true, 9 | css: cssOptions, 10 | chainWebpack, 11 | configureWebpack: webpackConfig, 12 | productionSourceMap: false, 13 | devServer, 14 | }; 15 | -------------------------------------------------------------------------------- /vuejs/webpack.config.js: -------------------------------------------------------------------------------- 1 | const { loaders, optimizations, resolvers, plugins } = require('./webpack'); 2 | 3 | module.exports = { 4 | devtool: 'source-map', 5 | module: { 6 | rules: [...loaders], 7 | }, 8 | optimization: optimizations, 9 | plugins: [...plugins], 10 | resolve: resolvers(__dirname), 11 | resolveLoader: { 12 | modules: ['node_modules'], 13 | }, 14 | stats: 'normal', 15 | }; 16 | -------------------------------------------------------------------------------- /vuejs/webpack/chain-webpack.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-param-reassign */ 2 | 3 | const BuildAppJSPlugin = require('./custom-plugins/buildAppJSPlugin'); 4 | const cdnDependencies = require('./custom-plugins/dependencies-cdn'); 5 | 6 | const cdn = { 7 | css: cdnDependencies.map((e) => e.css).filter((e) => e), 8 | js: cdnDependencies.map((e) => e.js).filter((e) => e), 9 | }; 10 | const isProd = process.env.NODE_ENV === 'production'; 11 | 12 | module.exports = (config) => { 13 | config.plugin('html').tap((args) => { 14 | args[0].minify = { 15 | ...args[0].minify, 16 | caseSensitive: true, 17 | collapseWhitespace: false, 18 | conservativeCollapse: true, 19 | keepClosingSlash: true, 20 | minifyCSS: true, 21 | minifyJS: true, 22 | removeComments: true, 23 | removeAttributeQuotes: false, 24 | removeRedundantAttributes: true, 25 | removeScriptTypeAttributes: false, 26 | removeStyleLinkTypeAttributes: false, 27 | }; 28 | return args; 29 | }); 30 | config.plugin('BuildAppJSPlugin').use(BuildAppJSPlugin); 31 | config.plugin('html').tap((args) => { 32 | if (isProd) { 33 | args[0].cdn = cdn; 34 | } else { 35 | args[0].cdn = { 36 | js: cdnDependencies.filter((e) => e.name === '').map((e) => e.js), 37 | css: cdnDependencies.filter((e) => e.name === '').map((e) => e.css), 38 | }; 39 | } 40 | args[0].inject = false; 41 | return args; 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /vuejs/webpack/css-options.js: -------------------------------------------------------------------------------- 1 | const package_data = require('../package.json'); 2 | 3 | const { production, development } = package_data.releases; 4 | const buildType = process.env.VUE_APP_BUILD; 5 | 6 | let buildVersion = ''; 7 | if (buildType) { 8 | if (buildType === 'prod') { 9 | buildVersion = production; 10 | } else { 11 | buildVersion = development; 12 | } 13 | } else { 14 | buildVersion = development; 15 | } 16 | 17 | const buildTheme = process.env.VUE_APP_THEME; 18 | const cdn = process.env.VUE_APP_CDN_PATH; 19 | const localBuild = process.env.VUE_APP_LOCAL; 20 | 21 | const correctedCdn = localBuild 22 | ? '/' 23 | : cdn.replace('@master', `@${buildVersion}`).replace('THEME', buildTheme) || 24 | '/'; 25 | process.env.VUE_APP_CDN_PATH = correctedCdn; 26 | 27 | const isProd = process.env.NODE_ENV === 'production'; 28 | 29 | module.exports = { 30 | requireModuleExtension: true, 31 | loaderOptions: { 32 | sass: { 33 | sassOptions: { 34 | prependData: `$cdnPath: "${isProd ? correctedCdn : '/'}";`, 35 | }, 36 | }, 37 | }, 38 | }; 39 | -------------------------------------------------------------------------------- /vuejs/webpack/custom-plugins/buildAppJSPlugin.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-param-reassign */ 2 | /* eslint-disable class-methods-use-this */ 3 | 4 | const cdnDependencies = require('./dependencies-cdn'); 5 | 6 | const cdn = { 7 | css: cdnDependencies.map((e) => e.css).filter((e) => e), 8 | js: cdnDependencies.map((e) => e.js).filter((e) => e), 9 | }; 10 | 11 | class BuildAppJSPlugin { 12 | apply(compiler) { 13 | compiler.hooks.emit.tapAsync( 14 | 'BuildAppJSPlugin', 15 | (compilation, callback) => { 16 | let cssarr = []; 17 | const jsarr = []; 18 | for (let filename in compilation.assets) { 19 | if (filename.match('.*\\.js$')) { 20 | if (process.env.NODE_ENV === 'production') { 21 | filename = (process.env.VUE_APP_CDN_PATH || '/') + filename; 22 | } else { 23 | filename = `/${filename}`; 24 | } 25 | jsarr.push(filename); 26 | } 27 | if (filename.match('.*\\.css$')) { 28 | cssarr.push(filename); 29 | } 30 | } 31 | cssarr = cssarr.sort((a) => a.indexOf('app.')); 32 | let cdnjs = ''; 33 | if (process.env.NODE_ENV === 'production') { 34 | cssarr = cdn.css.concat(cssarr); 35 | cdnjs = `var cdnjs = ${JSON.stringify(cdn.js)}; 36 | cdnjs.forEach((item) => { 37 | document.write(''); 38 | });`; 39 | } else { 40 | cssarr = cssarr.concat( 41 | cdnDependencies.filter((e) => e.name === '').map((e) => e.css), 42 | ); 43 | } 44 | const content = ` 45 | var scripts = ${JSON.stringify(jsarr)}; 46 | ${cdnjs} 47 | scripts.forEach((item) => { 48 | document.write(''); 49 | }); 50 | `; 51 | let cssContent = ''; 52 | cssarr.forEach((item) => { 53 | cssContent += `@import url(${item});\n`; 54 | }); 55 | compilation.assets['app.js'] = { 56 | source() { 57 | return content; 58 | }, 59 | size() { 60 | return jsarr.length; 61 | }, 62 | }; 63 | 64 | compilation.assets['style.css'] = { 65 | source() { 66 | return cssContent; 67 | }, 68 | size() { 69 | return cssarr.length; 70 | }, 71 | }; 72 | 73 | callback(); 74 | }, 75 | ); 76 | } 77 | } 78 | 79 | module.exports = BuildAppJSPlugin; 80 | -------------------------------------------------------------------------------- /vuejs/webpack/custom-plugins/dependencies-cdn.js: -------------------------------------------------------------------------------- 1 | const deps = [ 2 | // { 3 | // name: 'vue', 4 | // library: 'Vue', 5 | // js: 'https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js', 6 | // css: '', 7 | // }, 8 | // { 9 | // name: 'vue-router', 10 | // library: 'VueRouter', 11 | // js: 'https://cdn.jsdelivr.net/npm/vue-router@3.1.6/dist/vue-router.min.js', 12 | // css: '', 13 | // }, 14 | // { 15 | // name: 'vuex', 16 | // library: 'Vuex', 17 | // js: 'https://cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.js', 18 | // css: '', 19 | // }, 20 | // { 21 | // name: 'axios', 22 | // library: 'axios', 23 | // js: 'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js', 24 | // css: '', 25 | // }, 26 | // { 27 | // name: 'element-ui', 28 | // library: 'ELEMENT', 29 | // js: 30 | // 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js' /* , css: 'https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css' */, 31 | // }, 32 | // { 33 | // name: 'lodash', 34 | // library: '_', 35 | // js: 'https://cdn.jsdelivr.net/npm/lodash@4.17.15/lodash.min.js', 36 | // css: '', 37 | // }, 38 | // { 39 | // name: 'js-cookie', 40 | // library: 'Cookies', 41 | // js: 'https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.min.js', 42 | // css: '', 43 | // }, 44 | // { 45 | // name: 'lowdb', 46 | // library: 'low', 47 | // js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/low.min.js', 48 | // css: '', 49 | // }, 50 | // { 51 | // name: 'lowdb/adapters/LocalStorage', 52 | // library: 'LocalStorage', 53 | // js: 'https://cdn.jsdelivr.net/npm/lowdb@1.0.0/dist/LocalStorage.min.js', 54 | // css: '', 55 | // }, 56 | // { 57 | // name: 'markdown-it', 58 | // library: 'markdownit', 59 | // js: 60 | // 'https://cdn.jsdelivr.net/npm/markdown-it@10.0.0/dist/markdown-it.min.js', 61 | // css: '', 62 | // }, 63 | { 64 | name: '', 65 | library: '', 66 | js: 'https://at.alicdn.com/t/font_1760192_axq33n6snd.js', 67 | css: '', 68 | }, 69 | { 70 | name: '', 71 | library: '', 72 | js: '', 73 | css: 74 | 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css', 75 | }, 76 | // { 77 | // name: '', 78 | // library: '', 79 | // js: '', 80 | // css: 81 | // 'https://cdn.jsdelivr.net/gh/mladenplavsic/css-ripple-effect@master/dist/ripple.css', 82 | // }, 83 | { 84 | name: '', 85 | library: '', 86 | js: '', 87 | css: 88 | 'https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css', 89 | }, 90 | { 91 | name: '', 92 | library: '', 93 | js: '', 94 | css: 95 | 'https://cdn.jsdelivr.net/npm/font-awesome-animation@0.2.1/dist/font-awesome-animation.min.css', 96 | }, 97 | // { 98 | // name: '', 99 | // library: '', 100 | // js: '', 101 | // css: 102 | // 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css', 103 | // }, 104 | // { 105 | // name: '', 106 | // library: '', 107 | // js: '', 108 | // css: 109 | // 'https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900', 110 | // }, 111 | // { 112 | // name: '', 113 | // library: '', 114 | // js: '', 115 | // css: 116 | // 'https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css', 117 | // }, 118 | // { name: '', library: '', js: 'https://unpkg.com/vue-select@latest', css: '' }, 119 | // { 120 | // name: 'v-select', 121 | // library: 'vselect', 122 | // js: '', 123 | // css: 'https://unpkg.com/vue-select@latest/dist/vue-select.css', 124 | // }, 125 | ]; 126 | 127 | const externals = {}; 128 | deps.forEach((item) => { 129 | externals[item.name] = item.library; 130 | }); 131 | 132 | module.exports = deps; 133 | exports.externals = externals; 134 | -------------------------------------------------------------------------------- /vuejs/webpack/dev-server.js: -------------------------------------------------------------------------------- 1 | const publicPath = process.env.VUE_APP_CDN_PATH || '/'; 2 | 3 | module.exports = { 4 | publicPath, 5 | proxy: { 6 | '/api': { 7 | target: 'https://glorytoheaven.tk/', 8 | ws: true, 9 | changeOrigin: true, 10 | pathRewrite: { 11 | '^/api': '', 12 | }, 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /vuejs/webpack/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | externals, 3 | default: detailed, 4 | } = require('./custom-plugins/dependencies-cdn'); 5 | 6 | exports.chainWebpack = require('./chain-webpack'); 7 | exports.loaders = require('./loaders'); 8 | exports.optimizations = require('./optimizations'); 9 | exports.cssOptions = require('./css-options'); 10 | exports.devServer = require('./dev-server'); 11 | exports.plugins = require('./plugins'); 12 | exports.resolvers = require('./resolvers'); 13 | 14 | exports.externals = { 15 | libs: externals, 16 | json: detailed, 17 | }; 18 | -------------------------------------------------------------------------------- /vuejs/webpack/loaders.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | const loaders = [ 4 | { 5 | test: /\.(png|svg|jpg|gif|pdf)$/, 6 | use: [ 7 | { 8 | loader: 'file-loader', 9 | options: { 10 | name: '[name].[ext]', 11 | }, 12 | }, 13 | ], 14 | }, 15 | { 16 | test: /\.scss$/, 17 | use: [ 18 | { 19 | loader: 'sass-loader', 20 | options: { 21 | implementation: require('sass'), 22 | sassOptions: { 23 | fiber: require('fibers'), 24 | }, 25 | }, 26 | }, 27 | ], 28 | }, 29 | ]; 30 | 31 | module.exports = loaders; 32 | -------------------------------------------------------------------------------- /vuejs/webpack/minimizers.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); 4 | 5 | const minimizers = [ 6 | new CssMinimizerPlugin({ 7 | minimizerOptions: { 8 | preset: [ 9 | 'default', 10 | { 11 | discardComments: { removeAll: true }, 12 | }, 13 | ], 14 | }, 15 | }), 16 | ]; 17 | 18 | module.exports = minimizers; 19 | -------------------------------------------------------------------------------- /vuejs/webpack/optimizations.js: -------------------------------------------------------------------------------- 1 | const Minimizers = require('./minimizers'); 2 | 3 | const isProd = process.env.NODE_ENV === 'production'; 4 | 5 | const productionConfig = { 6 | splitChunks: { 7 | chunks: 'async', 8 | minSize: 20000, 9 | maxSize: 0, 10 | minChunks: 1, 11 | maxAsyncRequests: 30, 12 | maxInitialRequests: 30, 13 | enforceSizeThreshold: 50000, 14 | cacheGroups: { 15 | defaultVendors: { 16 | test: /[\\/]node_modules[\\/]/, 17 | priority: -10, 18 | reuseExistingChunk: true, 19 | }, 20 | default: { 21 | minChunks: 2, 22 | priority: -20, 23 | reuseExistingChunk: true, 24 | }, 25 | }, 26 | }, 27 | minimize: true, 28 | minimizer: [...Minimizers], 29 | }; 30 | 31 | const devConfig = { 32 | minimize: false, 33 | minimizer: [...Minimizers], 34 | }; 35 | 36 | module.exports = isProd ? productionConfig : devConfig; 37 | -------------------------------------------------------------------------------- /vuejs/webpack/plugins.js: -------------------------------------------------------------------------------- 1 | const CompressionWebpackPlugin = require('compression-webpack-plugin'); 2 | const zlib = require('zlib'); 3 | const JavaScriptObfuscator = require('webpack-obfuscator'); 4 | 5 | const isProd = process.env.NODE_ENV === 'production'; 6 | 7 | const prodPlugins = [ 8 | new CompressionWebpackPlugin({ 9 | filename: '[path].br', 10 | algorithm: 'brotliCompress', 11 | compressionOptions: { 12 | params: { 13 | [zlib.constants.BROTLI_PARAM_QUALITY]: 11, 14 | }, 15 | }, 16 | test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'), 17 | threshold: 10240, 18 | minRatio: 0.8, 19 | }), 20 | new JavaScriptObfuscator( 21 | { 22 | compact: false, 23 | rotateStringArray: true, 24 | stringArray: true, 25 | shuffleStringArray: true, 26 | numbersToExpressions: true, 27 | simplify: true, 28 | splitStrings: true, 29 | }, 30 | [ 31 | 'worker.js', 32 | 'js/chunk-vendors.*.js', 33 | 'js/chunk-vendors.*.js.br', 34 | 'js/chunk-vendors.*.js.map', 35 | ], 36 | ), 37 | ]; 38 | 39 | module.exports = isProd ? prodPlugins : []; 40 | -------------------------------------------------------------------------------- /vuejs/webpack/resolvers.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | const root = './src'; 4 | const assets = './src/assets'; 5 | const utils = './src/utils'; 6 | const api = './src/api'; 7 | 8 | module.exports = (dir) => ({ 9 | alias: { 10 | '@': path.resolve(dir, root), 11 | '@assets': path.resolve(dir, assets), 12 | '@utils': path.resolve(dir, utils), 13 | '@api': path.resolve(dir, api), 14 | }, 15 | extensions: ['.js', '.vue', '.json', '.css', '.scss'], 16 | symlinks: true, 17 | modules: ['node_modules'], 18 | }); 19 | --------------------------------------------------------------------------------