Skip to content

Added TecnoMap #228

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added submissions/TecnoMap/assets/tecnomap-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/TecnoMap/assets/tecnomap-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submissions/TecnoMap/assets/tecnomap-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions submissions/TecnoMap/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"manifest_version": 3,
"name": "TecnoMap Extension",
"version": "1.0.0",
"description": "An extension that redirects some BlueMap requests to your game to display your personal data.",
"permissions": [
"activeTab"
],
"host_permissions": [
"https://mappa.tecnocraft.net/*"
],
"action": {
"default_popup": "popup.html",
"default_icon": "assets/tecnomap-128.png"
},
"content_scripts": [
{
"matches": [
"https://mappa.tecnocraft.net/*"
],
"js": [
"scripts/content.js"
],
"run_at": "document_start",
"world": "MAIN"
}
],
"icons": {
"16": "assets/tecnomap-16.png",
"48": "assets/tecnomap-48.png",
"128": "assets/tecnomap-128.png"
},
"browser_specific_settings": {
"gecko": {
"id": "[email protected]"
}
}
}
10 changes: 10 additions & 0 deletions submissions/TecnoMap/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Nobody will see this - reloia</title>
<script type="module" src="scripts/popup.js"></script>
</head>
<body>
</body>
</html>
22 changes: 22 additions & 0 deletions submissions/TecnoMap/scripts/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(async () => {
const originalFetch = fetch;
let port = 8998;

console.log("TecnoMap - Using port", port);

window.fetch = async (...args) => {
if (typeof args[0] === "object" && args[0].url) {
try {
if (args[0].url.includes("markers.json"))
return originalFetch(`http://localhost:${port}/markers`);
else if (args[0].url.includes("players.json"))
return originalFetch(`http://localhost:${port}/position`);
} catch (error) {
console.log("TecnoMap - Error when fetching", error);
}
}
return originalFetch(...args);
};

console.log("TecnoMap - Content script loaded");
})();
8 changes: 8 additions & 0 deletions submissions/TecnoMap/scripts/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if (window.chrome) window.browser = window.chrome;

window.browser.tabs.query({active: true, currentWindow: true}, function (tab) {
if (!tab[0].url || !tab[0].url.includes("https://mappa.tecnocraft.net/")) {
window.browser.tabs.create({url: "https://mappa.tecnocraft.net/"});
window.close();
}
});