├── turing.png ├── weather.png ├── components ├── Libs │ ├── PriceRaw.tsx │ ├── Cap.ts │ ├── OpeningDetail.tsx │ ├── TextEndAbbreviation.ts │ ├── Bold.tsx │ ├── Langs.ts │ ├── ToLocaleDateTime.tsx │ ├── TextMidAbbreviation.ts │ ├── SerialGenerator.ts │ ├── FirstTimeComponentLoad.ts │ ├── replaveServerDates.ts │ ├── Comment.tsx │ ├── NumAbbrev.ts │ ├── Window.tsx │ ├── ReplacePro.tsx │ ├── GridBtn.tsx │ ├── HashTrack.tsx │ ├── ServiceExpiration.ts │ ├── Copy.ts │ ├── Icon2CurrencySelectFloat.tsx │ ├── WalletList.tsx │ ├── Checkbox.tsx │ ├── TextCenter.tsx │ ├── UniqueInterval.ts │ ├── FindEmojies.ts │ ├── Component.ts │ ├── NewUpload.tsx │ ├── TextArea.tsx │ ├── Circle.tsx │ ├── CurrencyChooserFloat.tsx │ ├── Num2EN.tsx │ ├── useNVState.ts │ ├── Icon2TitlesWide.tsx │ ├── VItem.tsx │ ├── DropDown.tsx │ ├── ItemList.tsx │ ├── FormV.tsx │ ├── UploadSingleBox.tsx │ ├── OpeningTitle.tsx │ ├── ItemListFloat.tsx │ ├── UploadBox.tsx │ ├── Flag.tsx │ ├── FormBackMaker.ts │ ├── CountDown.tsx │ ├── PhoneEditFloat.tsx │ ├── VItemList.tsx │ ├── WindowFloat.tsx │ ├── ReplaceWordRegex.ts │ ├── TextAreaEditFloat.tsx │ ├── CountryList.tsx │ ├── Country2Lang.json │ ├── TextEditFloat.tsx │ ├── PhoneBox.tsx │ ├── PriceTextBox.tsx │ ├── Icon2Titles.tsx │ ├── UserAvatar.tsx │ ├── UploadVisibility.tsx │ ├── HandRankExplore.tsx │ ├── Icon3Titles.tsx │ ├── Lorem.tsx │ ├── ProfileImage.tsx │ ├── FormS.tsx │ ├── Search.tsx │ ├── FormM.tsx │ ├── LinkHashtags.tsx │ ├── TextBoxBottom.tsx │ └── Num2FA.tsx ├── ROOT │ ├── Schedule │ │ ├── Job │ │ │ ├── JD1.ts │ │ │ ├── JH1.ts │ │ │ ├── JM1.ts │ │ │ ├── JM5.ts │ │ │ ├── JM15.ts │ │ │ └── JM30.ts │ │ ├── H1.ts │ │ ├── M15.ts │ │ ├── M30.ts │ │ ├── M5.ts │ │ ├── S10.ts │ │ ├── S30.ts │ │ └── M1.ts │ ├── TimeOffset.ts │ ├── Websocket │ │ ├── echo.ts │ │ ├── subscribe.ts │ │ └── hook.ts │ ├── OnExit.ts │ ├── Websocket.ts │ ├── Mongo.ts │ ├── Lang.ts │ └── Declarations.ts ├── Parent │ ├── QSON.ts │ ├── Progress.ts │ ├── QELoader.tsx │ ├── Scroller.ts │ └── Declarations.ts ├── SiteConfig.ts ├── User.ts ├── UserSSR.ts ├── SSRVerify.ts ├── Pages │ └── index.tsx └── APIVerify.ts ├── .vs ├── slnx.sqlite └── slnx.sqlite-journal ├── pages ├── api │ ├── ping.ts │ ├── lang.ts │ ├── umongo │ │ ├── collections.ts │ │ └── create.ts │ ├── login.ts │ ├── robots.ts │ ├── sitemap.ts │ └── test.ts ├── stylesx.css ├── index.tsx ├── _app.tsx └── [...path].tsx ├── weather.js ├── public ├── vercel.svg └── next.svg ├── process.d.ts ├── package.json ├── .gitignore ├── tsconfig.json ├── lib └── mongodb.ts ├── README.md ├── next.config.mjs ├── startup.ts └── global.d.ts /turing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnitaSobhanian/uweather2/HEAD/turing.png -------------------------------------------------------------------------------- /weather.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnitaSobhanian/uweather2/HEAD/weather.png -------------------------------------------------------------------------------- /components/Libs/PriceRaw.tsx: -------------------------------------------------------------------------------- 1 | export default (props)=> 2 | { 3 | return <> 4 | } -------------------------------------------------------------------------------- /.vs/slnx.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnitaSobhanian/uweather2/HEAD/.vs/slnx.sqlite -------------------------------------------------------------------------------- /components/Libs/Cap.ts: -------------------------------------------------------------------------------- 1 | export default (txt:string):string=> txt.charAt(0).toUpperCase() + txt.slice(1); -------------------------------------------------------------------------------- /.vs/slnx.sqlite-journal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnitaSobhanian/uweather2/HEAD/.vs/slnx.sqlite-journal -------------------------------------------------------------------------------- /components/ROOT/Schedule/Job/JD1.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | global.Schedule(23,59,59, ()=>{ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/Job/JH1.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | global.Schedule(null,0,0, ()=>{ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/Job/JM1.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | global.Schedule(null,null,0, ()=>{ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/Job/JM5.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | global.Schedule(null,null,0, ()=>{ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/Job/JM15.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | global.Schedule(null,null,0, ()=>{ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/Job/JM30.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | global.Schedule(null,null,0, ()=>{ 3 | }) 4 | } 5 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/H1.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | 4 | }, 3600000) 5 | } 6 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/M15.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | 4 | }, 900000) 5 | } 6 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/M30.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | 4 | }, 1800000) 5 | } 6 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/M5.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | 4 | }, 300000) 5 | } 6 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/S10.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | 4 | }, 10000) 5 | } 6 | -------------------------------------------------------------------------------- /components/ROOT/Schedule/S30.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | 4 | }, 30000) 5 | } 6 | -------------------------------------------------------------------------------- /components/Parent/QSON.ts: -------------------------------------------------------------------------------- 1 | export default ()=>{ 2 | if (!global.QSON) { 3 | global.QSON = { 4 | stringify: (obj) => JSON.stringify(obj), 5 | parse: (str) => JSON.parse(str) 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /components/Libs/OpeningDetail.tsx: -------------------------------------------------------------------------------- 1 | export default (props)=> 2 | { 3 | return
4 | {props.open?props.children:null} 5 |
6 | } -------------------------------------------------------------------------------- /components/Libs/TextEndAbbreviation.ts: -------------------------------------------------------------------------------- 1 | export default (text:string, maxlen:number)=> { 2 | if(text?.length > maxlen) 3 | { 4 | var up = text.substr(0 , maxlen - 3) 5 | return up+"..." 6 | } 7 | return text+" " 8 | } -------------------------------------------------------------------------------- /components/Libs/Bold.tsx: -------------------------------------------------------------------------------- 1 | export default (props)=>{ 2 | return {props.on?.()}}>{props.children} 5 | } -------------------------------------------------------------------------------- /components/Libs/Langs.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | "ar": "العربية", "zh": "中國人", "en": "english", "fa": "فارسی", 3 | "ru": "русский", "de": "deutsch", "fr": "français", "es": "español", "ja": "日本語", "ko": "한국어", 4 | "pt": "português", "tr": "Türkçe", "ur": "اُردُو", "id": "bahasa" 5 | } -------------------------------------------------------------------------------- /components/Libs/ToLocaleDateTime.tsx: -------------------------------------------------------------------------------- 1 | export default (date:Date)=>{ 2 | return 3 | {date.toLocaleDateString(lang.region)} 4 | 5 | {date.toLocaleTimeString(lang.region)} 6 | 7 | } -------------------------------------------------------------------------------- /components/Libs/TextMidAbbreviation.ts: -------------------------------------------------------------------------------- 1 | export default (text:string, maxlen:number)=> { 2 | if(text.length > maxlen) 3 | { 4 | var up = text.substr(0 , (maxlen/2 - 3)) 5 | var down = text.substr(text.length - (maxlen/2 - 3)) 6 | return up+"..."+down 7 | } 8 | return text 9 | } -------------------------------------------------------------------------------- /pages/api/ping.ts: -------------------------------------------------------------------------------- 1 | // This is an example of how to access a session from an API route 2 | import type { NextApiRequest, NextApiResponse } from "next" 3 | 4 | 5 | 6 | export default async (req: NextApiRequest, res: NextApiResponse) => { 7 | 8 | res.send({ code: 0, cdn: process.env.CDN, pong:true}) 9 | } 10 | -------------------------------------------------------------------------------- /weather.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | 3 | ; (async () => { 4 | 5 | let json = await (await fetch("https://cdn.ituring.ir/research/api/weather/")).json() 6 | 7 | 8 | fs.writeFileSync("./w.json", JSON.stringify(json, null, 2)) 9 | console.log("Finished") 10 | 11 | 12 | })() -------------------------------------------------------------------------------- /components/Libs/SerialGenerator.ts: -------------------------------------------------------------------------------- 1 | 2 | export default (len:number):string =>{ 3 | var chars = "0123456789ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; 4 | var randomstring = ''; 5 | for (var i=0; i { 3 | global.timeoffset = 0; 4 | // try { 5 | // var cryptotimesync = await fetch("https://bitquery.io/wp-content/uploads/2020/09/bitquery_logo_w.png") 6 | // global.timeoffset = new Date(cryptotimesync.headers.get("date")).getTime() - new Date().getTime(); 7 | // } 8 | // catch { } 9 | 10 | // console.log("Crypto time offset is:" + global.timeoffset + " ms"); 11 | } 12 | -------------------------------------------------------------------------------- /pages/api/lang.ts: -------------------------------------------------------------------------------- 1 | // This is an example of how to access a session from an API route 2 | import APIVerify from "@/components/APIVerify"; 3 | import type { NextApiRequest, NextApiResponse } from "next" 4 | 5 | 6 | 7 | export default async (req: NextApiRequest, res: NextApiResponse) => { 8 | 9 | var { valid, post, userip, email, role, verify, body, } = await APIVerify(req, res); 10 | res.send(global.langs[req.query.lang.toString() || "fa"]) 11 | } 12 | -------------------------------------------------------------------------------- /components/ROOT/Websocket/echo.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export default async (connection, body) => { 4 | 5 | 6 | connection.on('message', async function incoming(data) { 7 | console.log("message from client to echo:"+ data.toString('utf8')) 8 | connection.send("echo back!"); 9 | }); 10 | connection.on('error', err => { 11 | 12 | }) 13 | connection.on('close', async (event) => { 14 | console.log("echo client closed!") 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /components/Libs/FirstTimeComponentLoad.ts: -------------------------------------------------------------------------------- 1 | import Router from "next/router" 2 | export default (callback)=> 3 | { 4 | if(typeof window != "undefined") 5 | { 6 | if(!global.currentpage) 7 | { 8 | global.currentpage = Router.asPath 9 | callback(); 10 | } 11 | else 12 | { 13 | if(global.currentpage != Router.asPath) 14 | { 15 | global.currentpage = Router.asPath 16 | callback(); 17 | } 18 | } 19 | } 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /pages/api/umongo/collections.ts: -------------------------------------------------------------------------------- 1 | // This is an example of how to access a session from an API route 2 | import type { NextApiRequest, NextApiResponse } from "next" 3 | import APIVerify from "@/components/APIVerify"; 4 | 5 | 6 | export default async (req: NextApiRequest, res: NextApiResponse) => { 7 | 8 | var { userip, role, body, } = await APIVerify(req, res); 9 | 10 | let cols = await global.db.collections() 11 | cols[0].collectionName 12 | res.send({ code: 0, cdn: process.env.CDN, pong:true}) 13 | } 14 | -------------------------------------------------------------------------------- /components/Libs/replaveServerDates.ts: -------------------------------------------------------------------------------- 1 | export default function replaceServerDates(obj:object) { 2 | if (obj instanceof Array) { 3 | for (let i = 0; i < obj.length; i++) { 4 | replaceServerDates(obj[i]); 5 | } 6 | } else if (typeof obj === 'object' && obj !== null) { 7 | for (let prop in obj) { 8 | if (obj.hasOwnProperty(prop)) { 9 | if (obj[prop] === 'SERVERDATE') { 10 | obj[prop] = new Date(); 11 | } else { 12 | replaceServerDates(obj[prop]); 13 | } 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /components/ROOT/OnExit.ts: -------------------------------------------------------------------------------- 1 | 2 | const makeoffline = async (colname = "worker") => { 3 | await global.db.collection(colname).updateMany({}, 4 | [ 5 | { 6 | $set: { ["WS" + process.env.CDN]: "offline" } 7 | } 8 | ], 9 | { 10 | upsert: false 11 | } 12 | ) 13 | } 14 | export default async () => { 15 | process.on('SIGINT', async function () { 16 | if (parseInt(process.env.CDN) > 0) { 17 | // await makeoffline("worker") 18 | } 19 | process.exit(0) // if you don't close yourself this will run forever 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /components/SiteConfig.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | URL: function(){ 3 | if(typeof document != "undefined") 4 | { 5 | var link = document.createElement("a"); 6 | link.href = "/"; 7 | let st = link.href; 8 | st = st.substring(0, st.length - 1); 9 | return st 10 | } 11 | return "/" 12 | }, 13 | 14 | sitefiles:"https://cdn.ituring.ir/userv", 15 | defaultFont:"Segoe UI, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,\ 16 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif", 17 | address:"https://1500.uservs.ir", 18 | } 19 | -------------------------------------------------------------------------------- /components/Libs/Comment.tsx: -------------------------------------------------------------------------------- 1 | 2 | import Bold from './Bold' 3 | 4 | export default (props: { 5 | image: string, on?: () => void, 6 | s?: number, title: string, comment: string 7 | }) => { 8 | return
props.on?.()}> 9 | 10 | 11 | 12 | 13 | 14 |

15 | {props.title} 16 | {props.comment}

17 |
18 |
19 |
20 |
21 | } 22 | -------------------------------------------------------------------------------- /components/Libs/NumAbbrev.ts: -------------------------------------------------------------------------------- 1 | 2 | export default (num:number, digits:number = 1):string => { 3 | const lookup = [ 4 | { value: 1, symbol: "" }, 5 | { value: 1e3, symbol: "k" }, 6 | { value: 1e6, symbol: "M" }, 7 | { value: 1e9, symbol: "G" }, 8 | { value: 1e12, symbol: "T" }, 9 | { value: 1e15, symbol: "P" }, 10 | { value: 1e18, symbol: "E" } 11 | ]; 12 | const rx = /\.0+$|(\.[0-9]*[1-9])0+$/; 13 | var item = lookup.slice().reverse().find(function(item) { 14 | return num >= item.value; 15 | }); 16 | return item ? (num / item.value).toLocaleString(lang.region,{maximumFractionDigits:digits}).replace(rx, "$1") + item.symbol : "0"; 17 | } 18 | -------------------------------------------------------------------------------- /components/Libs/Window.tsx: -------------------------------------------------------------------------------- 1 | import { CSSProperties } from "react" 2 | 3 | export default (props?:{ 4 | title?:string, 5 | contentbg?:string, 6 | children?:any, 7 | style?:CSSProperties 8 | })=> 9 | { 10 | return <> 11 |
13 | {props.title? 14 | {props.title} 15 | :null} 16 | 17 | {props.children} 18 | 19 |
20 | 21 | 22 | } -------------------------------------------------------------------------------- /process.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace NodeJS { 2 | export interface ProcessEnv { 3 | NEXTAUTH_URL: string 4 | NEXTAUTH_SECRET: string 5 | GITHUB_ID: string 6 | GITHUB_SECRET: string 7 | LINKEDIN_CLIENT_ID: string 8 | LINKEDIN_CLIENT_SECRET: string 9 | FACEBOOK_ID: string 10 | FACEBOOK_SECRET: string 11 | TWITTER_ID: string 12 | TWITTER_SECRET: string 13 | GOOGLE_ID: string 14 | GOOGLE_SECRET: string 15 | AUTH0_ID: string 16 | AUTH0_SECRET: string 17 | MAINDOMAIN:string 18 | DOMAIN:string 19 | URL:string 20 | CDN:string 21 | PORT:string 22 | MAXCDN:string 23 | WSPORT:number 24 | PASSCODE:string 25 | MONGOURL:string 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "axios": "^1.7.2", 13 | "cookies-next": "^4.2.1", 14 | "crypto-js": "^4.2.0", 15 | "mongodb": "^6.8.0", 16 | "next": "14.2.5", 17 | "node-schedule": "^2.1.1", 18 | "react": "^18", 19 | "react-dom": "^18", 20 | "request-ip": "^3.3.0", 21 | "ws": "^8.18.0" 22 | }, 23 | "devDependencies": { 24 | "@types/node": "^20", 25 | "@types/react": "^18", 26 | "@types/react-dom": "^18", 27 | "typescript": "^5" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pages/stylesx.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 3 | "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, 4 | "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 5 | padding: 0 1rem 1rem 1rem; 6 | max-width: 680px; 7 | margin: 0 auto; 8 | background: #fff; 9 | color: #333; 10 | } 11 | 12 | li, 13 | p { 14 | line-height: 1.5rem; 15 | } 16 | 17 | a { 18 | font-weight: 500; 19 | } 20 | 21 | hr { 22 | border: 1px solid #ddd; 23 | } 24 | 25 | iframe { 26 | background: #ccc; 27 | border: 1px solid #ccc; 28 | height: 10rem; 29 | width: 100%; 30 | border-radius: 0.5rem; 31 | filter: invert(1); 32 | } 33 | -------------------------------------------------------------------------------- /components/Libs/ReplacePro.tsx: -------------------------------------------------------------------------------- 1 | export default (array:any[] | string, text:string, obj:any):any[] => 2 | { 3 | let uniquekey = new Date().getTime(); 4 | var arr = array; 5 | if(typeof arr == "string") 6 | { 7 | arr = [array as any] 8 | } 9 | 10 | var temparr = []; 11 | for(let a = 0; a < arr.length; a++) 12 | { 13 | var x = arr[a]; 14 | if(typeof x == "string" && x.includes(text)) 15 | { 16 | var p = x.split(text) 17 | for(let i = 0; i < p.length; i++) 18 | { 19 | temparr.push(p[i]) 20 | if(p.length - 1 != i) 21 | { 22 | temparr.push(obj) 23 | } 24 | } 25 | } 26 | else 27 | { 28 | temparr.push(x) 29 | } 30 | } 31 | return temparr 32 | } -------------------------------------------------------------------------------- /components/Libs/GridBtn.tsx: -------------------------------------------------------------------------------- 1 | import { Grid } from "@mui/material"; 2 | import Component, { PageEl } from '../Libs/Component'; 3 | export default p => Component(p, Page); 4 | const Page: PageEl = (props, state, refresh, getProps):JSX.Element => { 5 | return 6 | props.on?.()}> 8 | 9 | {props.title} 10 | 11 | 12 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | 38 | /push.exe/publish.exe 39 | /push.sh 40 | /publish.sh 41 | /push 42 | /publish 43 | /node_modules/* 44 | /.next 45 | push.exe 46 | publish.exe 47 | /packages 48 | /chrome 49 | /bin 50 | /*/bin 51 | /*/obj 52 | /push.exe 53 | /publish.exe 54 | -------------------------------------------------------------------------------- /components/User.ts: -------------------------------------------------------------------------------- 1 | const user = (ssession): User => //server session from SSR 2 | { 3 | let session: any = { } 4 | 5 | if (ssession && ssession.path) { 6 | session.path = ssession.path 7 | } 8 | 9 | 10 | var obj: User = { 11 | loggedin: !!session?.user?.email, 12 | name: session?.user?.name || "unknown user", 13 | uid: session?.user?.uid || null, 14 | email: session?.user?.email, 15 | phone: session?.user?.phone, 16 | role: session?.user?.role, 17 | path: ssession?.path, 18 | } 19 | 20 | return obj; 21 | } 22 | 23 | 24 | export type User = { 25 | loggedin: boolean 26 | name: string | null 27 | uid: string | null 28 | email: string | null 29 | phone: string | null 30 | role: string | null 31 | path: string | null 32 | } 33 | 34 | export default user; -------------------------------------------------------------------------------- /pages/index.tsx: -------------------------------------------------------------------------------- 1 | 2 | export default ()=> { 3 | return null 4 | } 5 | 6 | export async function getServerSideProps(context) 7 | { 8 | if (global.Startup != "OK") { 9 | if (global.Startup == "PENDING") { 10 | await new Promise(r => setInterval(() => { if (global.Startup != "PENDING") r(null) }, 100)) 11 | } 12 | else { 13 | global.Startup = "PENDING"; 14 | await (await import("../startup.ts")).Run() 15 | global.Startup = "OK"; 16 | } 17 | } 18 | 19 | // console.log("QUERYLLLLLLLLLLLLLLLLLLLL: ",context.query) 20 | 21 | // var { email, blocked, userip, role, session } = await global.SSRVerify(context) 22 | 23 | return { 24 | redirect: { 25 | permanent: false, 26 | // destination: "/"+lang, 27 | destination: "/fa", 28 | }, 29 | props:{} 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /components/Libs/HashTrack.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | import Copy from './Copy' 3 | import Bold from './Bold' 4 | 5 | import Component, { PageEl } from './Component'; 6 | export default p => Component(p, Page); 7 | const Page: PageEl = (props, state, refresh, getProps):JSX.Element => { 8 | return
9 | {props.title} 10 |
{props.body} 11 |  payment type 12 |    payment type{ 13 | Copy(props.copyval||props.body) 14 | alerter("Hash link copied to clipboard.") 15 | }}/> 16 |
17 |
18 | } -------------------------------------------------------------------------------- /components/Libs/ServiceExpiration.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export const ServiceExpirationProjs = { timequota: 1, lockdate: 1, regdate: 1, extimequota: 1 } 4 | export const ServiceExpirationFields = ["timequota", "lockdate", "regdate", "extimequota"] 5 | export default (servitem) => { 6 | const env = process.env.NODE_ENV 7 | 8 | if (servitem.timequota == 0) { 9 | return { expiredate: new Date(0), expiretick: 0, expired: false } 10 | } 11 | var now = servitem.lockdate || new Date().getTime(); 12 | var expdate = (servitem.lockdate ? (new Date().getTime() - servitem.lockdate) : 0) + 13 | servitem.regdate + (servitem.timequota + (servitem.extimequota || 0)) * 86400000; 14 | if (env == "development") { 15 | expdate -= (expdate % 10000) 16 | } 17 | return { expiredate: new Date(expdate), expiretick: expdate, expired: servitem ? (now - expdate > 0) : false } 18 | } 19 | -------------------------------------------------------------------------------- /components/Libs/Copy.ts: -------------------------------------------------------------------------------- 1 | export default (textToCopy: string)=> { 2 | // navigator clipboard api needs a secure context (https) 3 | if (navigator.clipboard && window.isSecureContext) { 4 | // navigator clipboard api method' 5 | return navigator.clipboard.writeText(textToCopy); 6 | } else { 7 | // text area method 8 | let textArea = document.createElement("textarea"); 9 | textArea.value = textToCopy; 10 | // make the textarea out of viewport 11 | textArea.style.position = "fixed"; 12 | textArea.style.left = "-999999px"; 13 | textArea.style.top = "-999999px"; 14 | document.body.appendChild(textArea); 15 | textArea.focus(); 16 | textArea.select(); 17 | return new Promise((res, rej) => { 18 | // here the magic happens 19 | document.execCommand('copy') ? res(null) : rej(); 20 | textArea.remove(); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /components/Libs/Icon2CurrencySelectFloat.tsx: -------------------------------------------------------------------------------- 1 | import WindowFloat from './WindowFloat'; 2 | import Icon2Titles from './Icon2Titles'; 3 | 4 | export default (props)=>{ 5 | return {props.onclose?.()}}> 6 | {Object.keys(global.user.wallets).map(k => { 7 | if(!global.user.wallets[k].donations || global.user.wallets[k].donations.length == 0) 8 | { 9 | return null; 10 | } 11 | let wallet = global.user.wallets[k]; 12 | let unit = wallet.unit; 13 | let amount = unit.tolocalstr(wallet?.balance); 14 | return {props.on?.(k)}} 20 | /> 21 | })} 22 | 23 | 24 | } -------------------------------------------------------------------------------- /components/Libs/WalletList.tsx: -------------------------------------------------------------------------------- 1 | import WindowFloat from './WindowFloat' 2 | import Icon3Titles from './Icon3Titles' 3 | import { useState } from 'react' 4 | 5 | export default (props)=> 6 | { 7 | var [form, setForm] = useState(null) 8 | props.functions.show = ()=> 9 | { 10 | setForm("wallets") 11 | } 12 | 13 | 14 | return form == "wallets"?setForm(null)} maxWidth="24rem" z={300}> 15 |
16 | {props.wallets?.map( x=> {x.Wallet}} 19 | title2={x.Owner} 20 | title3={x.Bank} 21 | icon={x.Logo} 22 | on={()=>{props.selected(x.Wallet); setForm(null)}} 23 | />)} 24 |
25 | 26 |
:null 27 | } -------------------------------------------------------------------------------- /components/Libs/Checkbox.tsx: -------------------------------------------------------------------------------- 1 | import { CSSProperties } from "react"; 2 | 3 | export default (props:{on:(cheched:boolean)=>{}, style?:CSSProperties, 4 | defaultChecked?:boolean, defaultValue?:boolean})=> 5 | { 6 | let uid = Math.floor(Math.random()*1000); 7 | return
8 | { 10 | props.on?.(e.target.checked) 11 | }} autoComplete="off"/> 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | } -------------------------------------------------------------------------------- /components/Libs/TextCenter.tsx: -------------------------------------------------------------------------------- 1 | import Copy from './Copy' 2 | 3 | export default (props:{ 4 | title?:string, 5 | sup?:string, 6 | fontSize?:number | string, 7 | value?:any, 8 | copyval?:string, 9 | copyalert?:string, 10 | })=> 11 | { 12 | return <> 13 | {props.title} {props.sup} 14 |
16 | {props.value}   17 |
18 | {props.copyval? { 19 | Copy(props.copyval) 20 | alerter(props.copyalert||"Copied to the clipboard") 21 | }} src ={global.cdn("/files/copy.svg")} alt="copy icon" style={{width:15, height:15}}/>:null} 22 |
23 |
24 | 25 | } -------------------------------------------------------------------------------- /components/Parent/Progress.ts: -------------------------------------------------------------------------------- 1 | import Router from 'next/router'; 2 | const styles = require('@/styles/Home.module.css') 3 | 4 | export const Runner = ()=>{ 5 | 6 | Router.events.on('routeChangeStart', (e) => { 7 | 8 | console.log("loading starts...") 9 | if(global.noloading) 10 | { 11 | global.noloading = false; 12 | return; 13 | } 14 | global.onunloader?.() 15 | global.winscrollers = {} 16 | let el = document.getElementById("grayer") 17 | el.style.display = "flex"; el.className = styles.op1 18 | }); 19 | Router.events.on('routeChangeComplete', () => { 20 | global.onunloader = null 21 | let el = document.getElementById("grayer") 22 | el.className = styles.op0 23 | setTimeout(() => el.style.display = "none", 400); 24 | }); 25 | Router.events.on('routeChangeError', () => { 26 | let el = document.getElementById("grayer") 27 | el.className = styles.op0 28 | setTimeout(() => el.style.display = "none", 400); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /components/Libs/UniqueInterval.ts: -------------------------------------------------------------------------------- 1 | import Router from "next/router" 2 | export default (name:string, func:()=>void, ms:number)=> 3 | { 4 | if(!global.intervalobjs) 5 | { 6 | global.intervalobjs = []; 7 | } 8 | var intervaluniqueid = name 9 | for(let interval of global.intervalobjs) 10 | { 11 | if(interval.page != Router.asPath || interval.uniqueid == intervaluniqueid) 12 | { 13 | clearInterval(interval.id) 14 | interval.expired = true; 15 | } 16 | } 17 | global.intervalobjs = global.intervalobjs.filter(x=>!x.expired); 18 | var free = true; 19 | global.intervalobjs.push( 20 | { 21 | page:Router.asPath, 22 | uniqueid: intervaluniqueid, 23 | expired:false, 24 | id: setInterval(() => 25 | { 26 | if(!free) 27 | { 28 | return; 29 | } 30 | free = false; 31 | func(); 32 | free = true; 33 | }, ms), 34 | }) 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /components/Libs/FindEmojies.ts: -------------------------------------------------------------------------------- 1 | export default (sentence:string):Array => { 2 | if (!sentence) { 3 | return [] 4 | } 5 | const regex = /\p{RI}\p{RI}|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u{200D}\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?)+|\p{EPres}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})/gu 6 | const matches = sentence.match(regex)?.filter(x => x.length > 0) || []; 7 | let em1 = matches ? matches : []; 8 | const regex2 = /[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u{1F92C}]/gu; 9 | const matches2 = sentence.match(regex2)?.filter(x => x.length > 0) || []; 10 | let em2 = matches2 ? matches2 : []; 11 | 12 | for (let x of em1) { 13 | if (!em2.includes(x)) { 14 | em2.push(x) 15 | } 16 | } 17 | let set = new Set(matches ? matches : []) 18 | return Array.from(set) 19 | } -------------------------------------------------------------------------------- /components/Parent/QELoader.tsx: -------------------------------------------------------------------------------- 1 | const styles = require('../../styles/Home.module.css') 2 | export default () => { 3 | return
5 | {/*
*/} 6 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 | } -------------------------------------------------------------------------------- /pages/api/login.ts: -------------------------------------------------------------------------------- 1 | // This is an example of how to access a session from an API route 2 | import APIVerify from "@/components/APIVerify"; 3 | import SerialGenerator from "@/components/Libs/SerialGenerator"; 4 | import type { NextApiRequest, NextApiResponse } from "next" 5 | 6 | 7 | 8 | export default async (req: NextApiRequest, res: NextApiResponse) => { 9 | 10 | var { valid, post, userip, email, role, verify, body, } = await APIVerify(req, res); 11 | 12 | console.log(body) 13 | let a = global.db.collection("users") 14 | let s = global.db.collection("sessions") 15 | let user = await a.findOne({ username: body.username, password: body.password }) 16 | if (user) { 17 | let token = SerialGenerator(30) 18 | let r = await s.insertOne({ sessionToken: token, userId: user._id, expires: new Date(new Date().getTime() + 5 * 86400000) }) 19 | console.log(r) 20 | res.setHeader("Set-Cookie", `session-token=${token}; Path=/; SameSite=Strict`).send({ code: 0 }) 21 | } 22 | else 23 | { 24 | res.send({code:-1}) 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /components/Libs/Component.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react' 2 | 3 | export type PageEl = (props: { [key in any]: any }, state: { [key in any]: any }, refresh: (object?: { [key in any]: any }) => void, getProps: (callback: () => Promise) => void) => JSX.Element 4 | 5 | const convertor = (props: any, Page: PageEl) => { 6 | let [state, setState] = useState({ loaded: false, }) 7 | let [r, setR] = useState(0) 8 | const setst = (obj) => { 9 | 10 | if (obj) { 11 | Object.keys(obj).forEach(k => { 12 | state[k] = obj[k] 13 | }) 14 | } 15 | state["kdt"] = new Date().getTime() 16 | setState(state) 17 | setR(new Date().getTime()) 18 | // setState({ ...state, ...obj }) 19 | } 20 | return Page(props, state, setst, async (func) => { 21 | if (!state.loaded) { 22 | await func(); 23 | state["loaded"] = true 24 | state["kdt"] = new Date().getTime() 25 | setState(state) 26 | setR(new Date().getTime()) 27 | // setState({ ...state, loaded: true }) 28 | } 29 | }) 30 | } 31 | 32 | 33 | export default (props: any, Page: PageEl) => { 34 | return convertor(props, Page) 35 | } 36 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2022", 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": false, 7 | "forceConsistentCasingInFileNames": true, 8 | "noEmit": true, 9 | "allowArbitraryExtensions": true, 10 | "allowImportingTsExtensions": true, 11 | "allowSyntheticDefaultImports": true, 12 | "module": "NodeNext", 13 | "moduleResolution": "NodeNext", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "jsx": "preserve", 17 | "incremental": true, 18 | "esModuleInterop": true, 19 | "importHelpers": true, 20 | "removeComments": true, 21 | "noImplicitAny": false, 22 | "strictNullChecks":false, 23 | 24 | "lib": [ 25 | "dom", 26 | "dom.iterable", 27 | "esnext" 28 | ], 29 | "plugins": [ 30 | { 31 | "name": "next" 32 | } 33 | ], 34 | "paths": { 35 | "@/*": ["./*"] 36 | } 37 | }, 38 | "include": [ 39 | "next-env.d.ts", 40 | ".next/types/**/*.ts", 41 | "global.d.ts", 42 | "**/*.ts", 43 | "**/*.tsx" 44 | ], 45 | "exclude": [ 46 | "node_modules" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /components/Libs/NewUpload.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react" 2 | import Bold from './Bold' 3 | import Copy from './Copy' 4 | import UploadSingleBox from './UploadSingleBox' 5 | import WindowFloat from './WindowFloat' 6 | 7 | export default (props:{extensionfilter?:any, defaultValue?:string, onclose?:()=>void, 8 | ondone?:(d?:string)=>void 9 | })=>{ 10 | let [upload, setUpload] = useState({}) 11 | let [cpicon, setCpIcon] = useState(global.cdn("/files/copy.svg")) 12 | return props.onclose?.()} z={260}> 13 | {setUpload({uploadval: n})}} value={upload.uploadval} reload={()=>{setCpIcon(global.cdn("/files/copy.svg"))}} 18 | lefticon={cpicon} onlefticon={()=>{Copy(upload.uploadval); setCpIcon(global.cdn("/files/ok.svg"))}}/> 19 | 20 | { 21 | props.ondone?.(typeof upload.uploadval == "string"?upload.uploadval:null) 22 | }}>{lang.finish} 23 | 24 | } -------------------------------------------------------------------------------- /components/ROOT/Schedule/M1.ts: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | setInterval(async () => { 3 | if(global.db) 4 | { 5 | let expids = Object.keys(global.expsviews||{}) 6 | let e = global.db.collection("explore"); 7 | for(let expid of expids) 8 | { 9 | if(global.expsviews[expid] > 0 && process.env.CDN != "0") 10 | { 11 | await e.updateOne({expid: new global.ObjectId(expid)}, {$inc:{views:global.expsviews[expid]}}); 12 | global.expsviews[expid] = 0; 13 | } 14 | } 15 | 16 | 17 | 18 | 19 | let jids = Object.keys(global.jidsviews||{}) 20 | let j = global.db.collection("journals"); 21 | for(let jid of jids) 22 | { 23 | if(global.jidsviews[jid] > 0 && process.env.CDN != "0") 24 | { 25 | await j.updateOne({jid: new global.ObjectId(jid)}, {$inc:{views:global.jidsviews[jid]}}) 26 | global.jidsviews[jid] = 0; 27 | } 28 | } 29 | } 30 | 31 | }, 60000) 32 | } 33 | -------------------------------------------------------------------------------- /lib/mongodb.ts: -------------------------------------------------------------------------------- 1 | // This approach is taken from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb 2 | 3 | 4 | var MongoClient = require("mongodb").MongoClient 5 | 6 | 7 | const uri = process.env.MONGOURL 8 | const options = { 9 | useUnifiedTopology: true, 10 | useNewUrlParser: true, 11 | } 12 | 13 | let client = null; 14 | let clientPromise 15 | 16 | if (!process.env.MONGOURL) { 17 | throw new Error("Please add your Mongo URI to .env.local") 18 | } 19 | 20 | if (process.env.NODE_ENV === "development") 21 | { 22 | // In development mode, use a global variable so that the value 23 | // is preserved across module reloads caused by HMR (Hot Module Replacement). 24 | if (!global._mongoClientPromise) 25 | { 26 | client = new MongoClient(uri, options) 27 | global._mongoClientPromise = client.connect() 28 | } 29 | clientPromise = global._mongoClientPromise 30 | } 31 | else 32 | { 33 | // In production mode, it's best to not use a global variable. 34 | client = new MongoClient(uri, options) 35 | clientPromise = client.connect() 36 | } 37 | 38 | 39 | // Export a module-scoped MongoClient promise. By doing this in a 40 | // separate module, the client can be shared across functions. 41 | export default clientPromise 42 | 43 | -------------------------------------------------------------------------------- /components/Libs/TextArea.tsx: -------------------------------------------------------------------------------- 1 | import { CSSProperties } from 'react' 2 | import Bold from './Bold' 3 | export default (props:{ 4 | bold?:boolean, 5 | title?:string, 6 | defaultValue?:string, 7 | placeholder?:string, 8 | readonly?:boolean, 9 | readOnly?:boolean, 10 | minHeight?:number|string, 11 | style?:CSSProperties 12 | on?:(string)=>void, 13 | selectonclick?:boolean, 14 | })=> 15 | { 16 | var uniqekey = Math.random()*100 17 | return
18 |
{props.bold?{props.title}:props.title}
19 |