-
I want to host a subscription file and think of github, but everyone could look at it and sometimes github doesn't work in my country. And it's too risky to host it inside country on a VPS. Please send websites/hostings where i can host and update my subscription |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
If cloudflare is working fine in your country, I suggest you use it to reverse proxy
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const actualUrlStr = url.pathname.replace("/sub/","/") // Change this to fit yours
const githubRawURL = `https://raw.githubusercontent.com/UserName/Repository/master${actualUrlStr}`;
const response = await fetchWithToken(githubRawURL, API_KEY); // Add API_KEY variable in cloudflare dash board
const newResponse = new Response(response.body, response);
newResponse.headers.set('Access-Control-Allow-Origin', '*');
return newResponse;
}
async function fetchWithToken(url, token) {
const headers = {
'Authorization': `Bearer ${token}`
};
const response = await fetch(url, { headers });
return response;
} Then visit |
Beta Was this translation helpful? Give feedback.
-
https://developers.google.com/drive/api/guides/manage-uploads#python_1 , you can use the Python Google Drive API client to upload a file to Google Drive.
import google.auth
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
from googleapiclient.errors import HttpError
def upload_basic():
"""Insert new file.
Returns : Id's of the file uploaded
Load pre-authorized user credentials from the environment.
"""
creds, _ = google.auth.default()
try:
# create drive api client
service = build('drive', 'v3', credentials=creds)
file_metadata = {'name': 'example.txt'}
media = MediaFileUpload('/usr/local/bin/example.txt',
mimetype='text/plain')
file = service.files().create(body=file_metadata, media_body=media,
fields='id').execute()
print(F'File ID: {file.get("id")}')
except HttpError as error:
print(F'An error occurred: {error}')
upload_basic() In this Python script, replace You can set up credentials in your environment using the export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json" Replace Then, run your Python script. If everything is set up correctly, the ID of the uploaded file should be printed in your terminal. Remember to replace necessary placeholders with your actual values. File upload success depends on the correct setup of Google API credentials and correct file path on your Ubuntu server. |
Beta Was this translation helpful? Give feedback.
Google Drive Direct Download
https://drive.google.com/file/d/1-aja5ydKFWb5DjjrwK-HefWgxN8PL4CI/view?usp=share_link
To convert the Google Drive link to a direct download link by modifying the URL, please follow these steps:
1: Copy the file ID from the original link. In this case, the file ID is "1-aja5ydKFWb5DjjrwK-HefWgxN8PL4CI".
2: Open a new tab in your web browser and enter the following URL:
3: https://drive.google.com/uc?export=download&id=
4: Paste the file ID at the end of the URL, immediately after "id=". The full URL should look like this:
5: https://drive.google.com/uc?export=download&id=1-aja5ydKFWb5DjjrwK-HefWgxN8PL4CI
6: Press Enter to load the modified URL. The file should …