-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beta #255
Open
jammesop007aha
wants to merge
91
commits into
SilentDemonSD:master
Choose a base branch
from
jammesop007aha:beta
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Beta #255
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift click to select a range
a9b0cc2
Bug Fix All
SilentDemonSD bdb25a7
Add GoFile Leech
SilentDemonSD abdc800
Add SendCM, DesiUpload, StreamTape
SilentDemonSD a90e149
fix up
SilentDemonSD 3ca15a7
Add External GoFile DL
SilentDemonSD 7db5dab
New Setup Starts
SilentDemonSD 4f8f5cb
fix
SilentDemonSD 48c2749
fix
SilentDemonSD 4591e76
fix frame
SilentDemonSD 2667230
Add Multi Aria2c
SilentDemonSD 1f64370
fix up
SilentDemonSD 357f0e4
try debug
SilentDemonSD 0c70db2
fix
SilentDemonSD e611911
fix Single Aria
SilentDemonSD 5aa37e4
Add Index Folder Support
SilentDemonSD 7b618c5
fix
SilentDemonSD 29ab8b5
refix
SilentDemonSD b39c7fb
Fix Dir prblm
SilentDemonSD 08dd67f
refix dir prblm
SilentDemonSD 99801a5
fix gd issue
SilentDemonSD bf80a7d
try debug
SilentDemonSD 1aa5c1e
fix
SilentDemonSD c3339a7
fix
SilentDemonSD 4954d3a
retry
SilentDemonSD 7bb03ee
retry
SilentDemonSD 9da1498
fix !
SilentDemonSD 8329231
try fix auto delete
SilentDemonSD 159010e
final completion
SilentDemonSD 99bfe22
fix recurring status
SilentDemonSD 48347b6
Add Universal filename
SilentDemonSD 9b370a2
fix
SilentDemonSD 8d6841e
Test New GDFLIX DOMAIN
MajnuRangeela 7536c76
Try New ..
SilentDemonSD c0b9354
improve
jammesop007aha be27ec4
improve
jammesop007aha 5329832
improve
jammesop007aha 3612779
improve
jammesop007aha e4b230d
improve
jammesop007aha 5f6a29a
improve
jammesop007aha 2d4f2c3
improve
jammesop007aha 6e86565
improve
jammesop007aha 5803270
improve
jammesop007aha 3f74cbb
improve
jammesop007aha da982d0
improve
jammesop007aha 6c7f887
improve
jammesop007aha ea7b23f
improve
jammesop007aha 528db39
improve
jammesop007aha d3b9984
improve
jammesop007aha 5142334
improve
jammesop007aha 678c43d
improve
jammesop007aha 224a993
improve
jammesop007aha eab1116
improve
jammesop007aha 5c004e3
improve
jammesop007aha 1fc6779
improve
jammesop007aha a4d485f
improve
jammesop007aha c5cfb79
improve
jammesop007aha 01f17e3
improve
jammesop007aha 89ea537
improve
jammesop007aha b188f0f
improve
jammesop007aha d118139
improve
jammesop007aha 15c9a80
improve
jammesop007aha f51e8d4
improve
jammesop007aha 8f4d917
improve
jammesop007aha 4bd3503
improve
jammesop007aha 27939b1
improve
jammesop007aha f2f86ec
improve
jammesop007aha beec95f
improve
jammesop007aha b69d2a0
improve
jammesop007aha 9e36e9b
improve
jammesop007aha f9b456d
improve
jammesop007aha 40a0429
improve
jammesop007aha ba6ca81
improve
jammesop007aha 3c5dd17
improve
jammesop007aha f7ffcd7
improve
jammesop007aha dbf5501
improve
jammesop007aha 634bdab
improve
jammesop007aha fb962aa
improve
jammesop007aha e51c1f7
improve
jammesop007aha 11cfa5f
improve
jammesop007aha 6d28985
improve
jammesop007aha d15dd67
improve
jammesop007aha ade7630
improve
jammesop007aha 9cf7158
improve
jammesop007aha 27e1610
improve
jammesop007aha 7d6af0e
improve
jammesop007aha ad5bd53
improve
jammesop007aha ec577b5
improve
jammesop007aha 5ac1aad
improve
jammesop007aha 0736539
improve
jammesop007aha bfed637
improve
jammesop007aha ffc7e58
improve
jammesop007aha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 1,24 @@ | ||
config.env | ||
*.pyc | ||
data* | ||
.vscode | ||
.idea | ||
*.json | ||
*.pickle | ||
.netrc | ||
log.txt | ||
accounts/* | ||
Thumbnails/* | ||
MediaInfo/* | ||
Images/* | ||
rclone/* | ||
list_drives.txt | ||
cookies.txt | ||
downloads | ||
bot.session | ||
user.session | ||
terabox.txt | ||
rclone.conf | ||
# A list of files and directories to be ignored by version control systems | ||
.gitignore = [ | ||
'config.env', | ||
'*.pyc', | ||
'data*', | ||
'.vscode', | ||
'.idea', | ||
'*.json', | ||
'*.pickle', | ||
'.netrc', | ||
'log.txt', | ||
'accounts/*', | ||
'Thumbnails/*', | ||
'MediaInfo/*', | ||
'Images/*', | ||
'rclone/*', | ||
'list_drives.txt', | ||
'cookies.txt', | ||
'downloads/', | ||
'bot.session', | ||
'user.session', | ||
'terabox.txt', | ||
'rclone.conf' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 1,20 @@ | ||
FROM mysterysd/wzmlx:latest | ||
# Use an official Python runtime as the base image | ||
FROM python:3.9-slim-buster | ||
|
||
WORKDIR /usr/src/app | ||
RUN chmod 777 /usr/src/app | ||
# Set the working directory to /app | ||
WORKDIR /app | ||
|
||
# Copy the requirements file to the working directory | ||
COPY requirements.txt . | ||
RUN pip3 install --no-cache-dir -r requirements.txt | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN apt-get update && apt-get install -y --no-cache-dir \ | ||
build-essential \ | ||
&& pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the current directory contents into the container at /app | ||
COPY . . | ||
|
||
# Make the script executable and run it | ||
RUN chmod x start.sh | ||
CMD ["bash", "start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 1,154 @@ | ||
from __future__ import print_function | ||
from google.oauth2.service_account import Credentials | ||
import googleapiclient.discovery | ||
import argparse | ||
import json | ||
from pathlib import Path | ||
import pickle | ||
import progress.bar | ||
import glob | ||
import sys | ||
import argparse | ||
import time | ||
from google_auth_oauthlib.flow import InstalledAppFlow | ||
from typing import Any, Dict, List, Optional | ||
|
||
import google.auth | ||
from google.auth.transport.requests import Request | ||
import os | ||
import pickle | ||
from google.oauth2.credentials import Credentials | ||
from google_auth_oauthlib.flow import InstalledAppFlow | ||
from googleapiclient.discovery import build | ||
from googleapiclient.errors import HttpError | ||
from googleapiclient.http import BatchHttpRequest | ||
|
||
chdrive = build("drive", "v3", credentials=None) | ||
|
||
class GoogleDriveTool: | ||
"""A tool to add service accounts to a shared drive from a folder containing credential files.""" | ||
|
||
def __init__(self, drive_id: str, credential_file: str, service_account_dir: str, yes: bool = False): | ||
self.drive_id = drive_id | ||
self.credential_file = credential_file | ||
self.service_account_dir = service_account_dir | ||
self.yes = yes | ||
|
||
def _get_service_account_emails(self) -> List[str]: | ||
"""Get the email addresses of all service accounts in the specified directory.""" | ||
service_account_files = list(self.service_account_dir.glob("*.json")) | ||
if not service_account_files: | ||
print(">> No service account files found.") | ||
sys.exit(0) | ||
|
||
service_account_emails = [] | ||
for file in service_account_files: | ||
with file.open() as f: | ||
data = json.load(f) | ||
service_account_emails.append(data["client_email"]) | ||
|
||
return service_account_emails | ||
|
||
def _authorize(self) -> Credentials: | ||
"""Authorize the user and get credentials.""" | ||
creds = None | ||
if Path("token_sa.pickle").exists(): | ||
with Path("token_sa.pickle").open("rb") as token: | ||
creds = pickle.load(token) | ||
|
||
if not creds or not creds.valid: | ||
if creds and creds.expired and creds.refresh_token: | ||
creds.refresh(Request()) | ||
else: | ||
flow = InstalledAppFlow.from_client_secrets_file( | ||
self.credential_file, | ||
scopes=[ | ||
"https://www.googleapis.com/auth/admin.directory.group", | ||
"https://www.googleapis.com/auth/admin.directory.group.member", | ||
], | ||
) | ||
creds = flow.run_console() | ||
|
||
with Path("token_sa.pickle").open("wb") as token: | ||
pickle.dump(creds, token) | ||
|
||
return creds | ||
|
||
def _add_service_accounts_to_drive(self, service_account_emails: List[str]): | ||
"""Add the specified service accounts to the shared drive.""" | ||
drive = googleapiclient.discovery.build("drive", "v3", credentials=self._authorize()) | ||
batch = drive.new_batch_http_request() | ||
|
||
for email in service_account_emails: | ||
batch.add( | ||
drive.permissions().create( | ||
fileId=self.drive_id, | ||
supportsAllDrives=True, | ||
body={ | ||
"role": "organizer", | ||
"type": "user", | ||
"emailAddress": email, | ||
}, | ||
) | ||
) | ||
|
||
try: | ||
batch.execute() | ||
except HttpError as error: | ||
print(f"An error occurred: {error}") | ||
sys.exit(1) | ||
|
||
def run(self): | ||
"""Run the tool.""" | ||
start_time = time.time() | ||
|
||
service_account_emails = self._get_service_account_emails() | ||
|
||
if not self.yes: | ||
input( | ||
f">> Make sure the Google account that has generated {self.credential_file} " | ||
"is added into your Team Drive (shared drive) as Manager\n>> (Press any key to continue)" | ||
) | ||
|
||
self._add_service_accounts_to_drive(service_account_emails) | ||
|
||
print("Complete.") | ||
hours, rem = divmod((time.time() - start_time), 3600) | ||
minutes, sec = divmod(rem, 60) | ||
print( | ||
f"Elapsed Time:\n{int(hours)}:{int(minutes)}:{sec:05.2f}" | ||
) | ||
|
||
if __name__ == "__main__": | ||
parse = argparse.ArgumentParser( | ||
description="A tool to add service accounts to a shared drive from a folder containing credential files." | ||
) | ||
parse.add_argument( | ||
"--path", | ||
"-p", | ||
default="accounts", | ||
help="Specify an alternative path to the service accounts folder.", | ||
) | ||
parse.add_argument( | ||
"--credentials", | ||
"-c", | ||
default="./credentials.json", | ||
help="Specify the relative path for the credentials file.", | ||
) | ||
parse.add_argument( | ||
"--yes", | ||
"-y", | ||
default=False, | ||
action="store_true", | ||
help="Skips the sanity prompt.", | ||
) | ||
parsereq = parse.add_argument_group("required arguments") | ||
parsereq.add_argument( | ||
"--drive-id", | ||
"-d", | ||
help="The ID of the Shared Drive.", | ||
required=True, | ||
) | ||
|
||
args = parse.parse_args() | ||
|
||
tool = GoogleDriveTool(args.drive_id, args.credentials, Path(args.path), args.yes) | ||
tool.run() | ||
|
||
|
||
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib | ||
pip install argcomplete | ||
|
||
|
||
stt = time.time() | ||
|
||
parse = argparse.ArgumentParser( | ||
description='A tool to add service accounts to a shared drive from a folder containing credential files.') | ||
parse.add_argument('--path', '-p', default='accounts', | ||
help='Specify an alternative path to the service accounts folder.') | ||
parse.add_argument('--credentials', '-c', default='./credentials.json', | ||
help='Specify the relative path for the credentials file.') | ||
parse.add_argument('--yes', '-y', default=False, | ||
action='store_true', help='Skips the sanity prompt.') | ||
parsereq = parse.add_argument_group('required arguments') | ||
parsereq.add_argument('--drive-id', '-d', | ||
help='The ID of the Shared Drive.', required=True) | ||
|
||
args = parse.parse_args() | ||
acc_dir = args.path | ||
did = args.drive_id | ||
credentials = glob.glob(args.credentials) | ||
|
||
try: | ||
open(credentials[0], 'r') | ||
print('>> Found credentials.') | ||
except IndexError: | ||
print('>> No credentials found.') | ||
sys.exit(0) | ||
|
||
if not args.yes: | ||
# input('Make sure the following client id is added to the shared drive as Manager:\n' json.loads((open( | ||
# credentials[0],'r').read()))['installed']['client_id']) | ||
input('>> Make sure the **Google account** that has generated credentials.json\n is added into your Team Drive ' | ||
'(shared drive) as Manager\n>> (Press any key to continue)') | ||
|
||
creds = None | ||
if os.path.exists('token_sa.pickle'): | ||
with open('token_sa.pickle', 'rb') as token: | ||
creds = pickle.load(token) | ||
# If there are no (valid) credentials available, let the user log in. | ||
if not creds or not creds.valid: | ||
if creds and creds.expired and creds.refresh_token: | ||
creds.refresh(Request()) | ||
else: | ||
flow = InstalledAppFlow.from_client_secrets_file(credentials[0], scopes=[ | ||
'https://www.googleapis.com/auth/admin.directory.group', | ||
'https://www.googleapis.com/auth/admin.directory.group.member' | ||
]) | ||
# creds = flow.run_local_server(port=0) | ||
creds = flow.run_console() | ||
# Save the credentials for the next run | ||
with open('token_sa.pickle', 'wb') as token: | ||
pickle.dump(creds, token) | ||
|
||
drive = googleapiclient.discovery.build("drive", "v3", credentials=creds) | ||
batch = drive.new_batch_http_request() | ||
|
||
aa = glob.glob('%s/*.json' % acc_dir) | ||
pbar = progress.bar.Bar("Readying accounts", max=len(aa)) | ||
for i in aa: | ||
ce = json.loads(open(i, 'r').read())['client_email'] | ||
batch.add(drive.permissions().create(fileId=did, supportsAllDrives=True, body={ | ||
"role": "organizer", | ||
"type": "user", | ||
"emailAddress": ce | ||
})) | ||
pbar.next() | ||
pbar.finish() | ||
print('Adding...') | ||
batch.execute() | ||
|
||
print('Complete.') | ||
hours, rem = divmod((time.time() - stt), 3600) | ||
minutes, sec = divmod(rem, 60) | ||
print("Elapsed Time:\n{:0>2}:{:0>2}:{:05.2f}".format( | ||
int(hours), int(minutes), sec)) | ||
import argcomplete | ||
argcomplete.autocomplete(parse) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apt-get install <package>
useapt-get install <package>=<version>
The issue identified by Hadolint is that the Dockerfile is using the
apt-get install
command without specifying the exact versions of the packages to be installed. This can lead to non-deterministic builds because the latest version of the packages available at the time of the build will be installed, which might change over time. To ensure a consistent and repeatable build environment, it's recommended to pin specific versions of the packages.Here's the suggested fix for the Dockerfile line:
Please replace
<version>
with the specific version of thebuild-essential
package that you want to install. Also, I removed the non-existent--no-cache-dir
option from theapt-get install
command, which is not valid forapt-get
(it's apip
option). Moreover, I included--no-install-recommends
to avoid installing unnecessary packages.This comment was generated by an experimental AI tool.