Skip to content

Commit

Permalink
V5.2 - Merged Tabs & Proxy Page + Formatted + Fixed Dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
xbubbo committed Apr 28, 2024
1 parent 92e9290 commit afb443e
Show file tree
Hide file tree
Showing 25 changed files with 598 additions and 848 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ As of January 1st, 2024, Replit is [no longer free](https://blog.replit.com/host
2. Click "Code" (green button) and then "Create Codespace on main."
3. In the terminal at the bottom, paste `pnpm i && pnpm start`.
4. Respond to the application popup by clicking "Make public."
> [!IMPORTANT]
> Make sure you click the "Make public." button, or the proxy won't function properly.
> [!IMPORTANT]
> Make sure you click the "Make public." button, or the proxy won't function properly.
5. Access the deployed website from the ports tab.
6. For subsequent uses in the same codespace, just run `pnpm start`

Expand Down
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ app.use(express.static(path.join(__dirname, "static")))

if (config.routes !== false) {
const routes = [
{ path: "/ap", file: "apps.html" },
{ path: "/g", file: "games.html" },
{ path: "/s", file: "settings.html" },
{ path: "/t", file: "tabs.html" },
{ path: "/p", file: "go.html" },
{ path: "/as", file: "apps.html" },
{ path: "/gm", file: "games.html" },
{ path: "/st", file: "settings.html" },
{ path: "/ta", file: "tabs.html" },
{ path: "/", file: "index.html" },
{ path: "/tos", file: "tos.html" },
]
Expand Down
10 changes: 5 additions & 5 deletions static/apps.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<script src="./m/config.js?v=5"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/styles/main.css?v=8" />
<link rel="stylesheet" href="/assets/styles/themes/default.css?v=5" />
<script src="/assets/scripts/main.js?v=38"></script>
<script src="/assets/scripts/index.js?v=14"></script>
<link rel="stylesheet" href="/assets/styles/global.css?v=8" />
<script src="/assets/scripts/m.js?v=42"></script>
<script src="/assets/scripts/i.js?v=18"></script>
<script src="https://kit.fontawesome.com/1237c86ba0.js" crossorigin="anonymous"></script>
<script src="assets/scripts/a.js?v=50"></script>
<script src="assets/scripts/a.js?v=52"></script>
</head>
<body>
<div class="fixed-nav-bar"></div>
Expand All @@ -38,7 +38,7 @@
</div>
<div class="pinned-apps"></div>
<div class="container-apps"></div>
<script src="/assets/scripts/main.js?v=38"></script>
<script src="/assets/scripts/m.js?v=42"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WKJQ5QHQTJ"></script>
<!-- DO NOT REMOVE-->
<script>
Expand Down
2 changes: 1 addition & 1 deletion static/assets/scripts/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function handleClick(app) {

if (app.local) {
saveToLocal(app.link)
window.location.href = "p"
window.location.href = "ta"
} else if (app.local2) {
saveToLocal(app.link)
window.location.href = app.link
Expand Down
223 changes: 223 additions & 0 deletions static/assets/scripts/fr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
const iframe = document.getElementById("iframe-container")

if (navigator.userAgent.includes("Chrome")) {
window.addEventListener("resize", function () {
navigator.keyboard.lock(["Escape"])
})
}

// Decode URL
function decodeXor(input) {
if (!input) return input
let [str, ...search] = input.split("?")

return (
decodeURIComponent(str)
.split("")
.map((char, ind) => (ind % 2 ? String.fromCharCode(char.charCodeAt(NaN) ^ 2) : char))
.join("") + (search.length ? "?" + search.join("?") : "")
)
}

// Button Variables
const iframeContainer = document.getElementById("iframe-container")
const iframes = Array.from(iframeContainer.querySelectorAll("iframe"))
const activeIframe = document.querySelector("#iframe-container iframe.active")

function Load() {
const activeIframe = document.querySelector("#iframe-container iframe.active")
if (activeIframe && document.readyState === "complete") {
const website = activeIframe.contentWindow.document.location.href

if (website.includes("/a/")) {
const websitePath = website.replace(window.location.origin, "").replace("/a/", "")
const decodedValue = decodeXor(websitePath)
document.getElementById("is").value = decodedValue
localStorage.setItem("decoded", decodedValue)
} else if (website.includes("/a/q/")) {
const websitePath = website.replace(window.location.origin, "").replace("/a/q/", "")
const decodedValue = decodeXor(websitePath)
document.getElementById("is").value = decodedValue
localStorage.setItem("decoded", decodedValue)
} else {
const websitePath = website.replace(window.location.origin, "")
document.getElementById("is").value = websitePath
localStorage.setItem("decoded", websitePath)
}
}
}

function OnLoad() {
if (window.loaded) {
console.log("OnLoad() function already executed. Exiting.")
return
}
window.loaded = true

let GoUrl = sessionStorage.getItem("GoUrl")
let dyValue = localStorage.getItem("dy")

if (!GoUrl) {
return
}

if (!GoUrl.startsWith("/e/")) {
if (dyValue === "true" || dyValue === "auto") {
GoUrl = "/a/q/" + GoUrl
} else {
GoUrl = "/a/" + GoUrl
}
} else {
}
console.log(GoUrl)

const activeIframe = document.querySelector("#iframe-container iframe.active")
if (!activeIframe) {
return
}

activeIframe.removeAttribute("onload")

activeIframe.contentWindow.document.location.href = GoUrl
setTimeout(Load, 1500)
}

// Reload
function reload() {
const activeIframe = document.querySelector("#iframe-container iframe.active")
if (activeIframe) {
activeIframe.src = activeIframe.src
Load()
} else {
console.error("No active iframe found")
}
}

// Popout
function popout() {
const activeIframe = document.querySelector("#iframe-container iframe.active")

if (activeIframe) {
const newWindow = window.open("about:blank", "_blank")

if (newWindow) {
const name = localStorage.getItem("name") || "My Drive - Google Drive"
const icon = localStorage.getItem("icon") || "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png"

newWindow.document.title = name

const link = newWindow.document.createElement("link")
link.rel = "icon"
link.href = encodeURI(icon)
newWindow.document.head.appendChild(link)

const newIframe = newWindow.document.createElement("iframe")
const style = newIframe.style
style.position = "fixed"
style.top = style.bottom = style.left = style.right = 0
style.border = style.outline = "none"
style.width = style.height = "100%"

newIframe.src = activeIframe.src

newWindow.document.body.appendChild(newIframe)
}
} else {
console.error("No active iframe found")
}
}

function erudaToggle() {
const activeIframe = document.querySelector("#iframe-container iframe.active")
if (!activeIframe) {
console.error("No active iframe found")
return
}

const erudaWindow = activeIframe.contentWindow
if (!erudaWindow) {
console.error("No content window found for the active iframe")
return
}

if (erudaWindow.eruda) {
if (erudaWindow.eruda._isInit) {
erudaWindow.eruda.destroy()
} else {
console.error("Eruda is not initialized in the active iframe")
}
} else {
const erudaDocument = activeIframe.contentDocument
if (!erudaDocument) {
console.error("No content document found for the active iframe")
return
}

const script = erudaDocument.createElement("script")
script.src = "https://cdn.jsdelivr.net/npm/eruda"
script.onload = function () {
if (!erudaWindow.eruda) {
console.error("Failed to load Eruda in the active iframe")
return
}
erudaWindow.eruda.init()
erudaWindow.eruda.show()
}
erudaDocument.head.appendChild(script)
}
}

// Fullscreen
function FS() {
const activeIframe = document.querySelector("#iframe-container iframe.active")
if (activeIframe) {
if (!activeIframe.contentDocument.fullscreenElement) {
activeIframe.contentDocument.documentElement.requestFullscreen()
} else {
activeIframe.contentDocument.exitFullscreen()
}
} else {
console.error("No active iframe found")
}
}

const fullscreenButton = document.getElementById("fullscreen-button")
fullscreenButton.addEventListener("click", FS)

// Home
function Home() {
window.location.href = "./"
}

const homeButton = document.getElementById("home-page")
homeButton.addEventListener("click", Home)

// Back
function goBack() {
const activeIframe = document.querySelector("#iframe-container iframe.active")
if (activeIframe) {
activeIframe.contentWindow.history.back()
iframe.src = activeIframe.src
Load()
} else {
console.error("No active iframe found")
}
}

// Forward
function goForward() {
const activeIframe = document.querySelector("#iframe-container iframe.active")
if (activeIframe) {
activeIframe.contentWindow.history.forward()
iframe.src = activeIframe.src
Load()
} else {
console.error("No active iframe found")
}
}

// Remove Nav
document.addEventListener("fullscreenchange", function () {
const isFullscreen = Boolean(document.fullscreenElement)
document.body.classList.toggle("fullscreen", isFullscreen)
})
Loading

0 comments on commit afb443e

Please sign in to comment.