Sindbad~EG File Manager
from core import app
from flask import url_for,render_template_string
from datetime import datetime, date, time, timedelta
# import random
import base64
from io import BytesIO
from PIL import Image
# from num2words import num2words
# from core.library.auth import Auth
#settime working as global variable but commented for easy identification of this variable using class name
# global settime
# settime = 5
class Helper:
# PaymentGatewayAppMasterID = 7 # IAGES23 razorpay
# PaymentGatewayISTest = 1 # testmode = 1
DefaultCountryID = 101 # for india country code
AppType = "MobileApp Admin"
# live_domain = "https://sc.aios-scientificcommittee.org/1/aios"
# cdn_url = "https://cdn.jsdelivr.net/gh/NumeroTec/ntec_cdn@main/"
is_local = 1
def imageToBase64(file):
img = Image.open(file)
# Convert image to a byte stream
buffered = BytesIO()
img.save(buffered, format="PNG") # You can adjust the format (e.g., "JPEG", "PNG")
img_bytes = buffered.getvalue()
# Encode the image bytes to base64
img_base64 = base64.b64encode(img_bytes).decode('utf-8')
return img_base64
# def test_login(data):
# return "Virtual Conference - 1"
# def footer_text():
# return "Virtual Conference - 1"
# def date_diff(d1, d2):
# # fmt = '%H:%M'
# d1 = date(d1,'%Y, %m, %d')
# d2 = date(d2,'%Y, %m, %d')
# diff = str(d1) - str(d2)
# # print(diff)
# return diff
# def random4digt():
# number = random.randint(1000,9999)
# return number
# def amountTowords(amount):
# words_in_amount = num2words(amount, lang='en_IN')
# return words_in_amount
# def amountTodecimal(amount):
# num = int(amount)
# rs = f"{num:,}"
# return rs
# def email_mask(email):
# if email:
# lo = email.find('@')
# if lo>0:
# mask_email = email[0]+"*****"+email[lo-1:]
# return mask_email
# return email
# def mobile_mask(mobile):
# if mobile:
# lo = len(mobile)
# if lo>0:
# mask = mobile[:2]+"******"+mobile[lo-2:]
# return mask
# return mobile
# def formatINR(number):
# s, *d = str(number).partition(".")
# r = ",".join([s[x-2:x] for x in range(-3, -len(s), -2)][::-1] + [s[-3:]])
# return "".join([r] + d)
# def convert_html(data):
# temp = app.jinja_env.from_string("{{login_content|safe}}").render(**data)
# return render_template_string(temp,**data)
# def convert_jinja_cert(self,tempt,data):
# temp = app.jinja_env.from_string(tempt).render(data=data)
# return render_template_string(temp,**data)
app.jinja_env.globals.update(Helper=Helper)
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists