Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixelicc committed Jul 28, 2023
1 parent 4186fbe commit 395d7b0
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 68 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pixelic-overlay",
"description": "",
"author": "Pixelic",
"version": "1.1.1",
"version": "1.1.2",
"main": "main.js",
"scripts": {
"start": "vite build && electron .",
Expand Down
49 changes: 26 additions & 23 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<v-toolbar density="compact" style="-webkit-app-region: drag; background-color: rgba(var(--v-theme-background), var(--opacity)) !important">
<v-app-bar-nav-icon variant="text" @click.stop="sidebar = !sidebar" style="-webkit-app-region: no-drag"></v-app-bar-nav-icon>

<v-toolbar-title class="grow"> Pixelic Overlay </v-toolbar-title>
<v-toolbar-title v-if="!sidebar" class="grow"> Pixelic Overlay </v-toolbar-title>
<v-toolbar-title v-if="sidebar" class="grow" style="-webkit-app-region: no-drag"> Pixelic Overlay </v-toolbar-title>

<v-btn v-if="table" icon @click="refreshPlayers" style="-webkit-app-region: no-drag">
<v-icon color="secondary">mdi-refresh</v-icon>
Expand Down Expand Up @@ -46,7 +47,7 @@
</v-list>
</v-navigation-drawer>
<router-view></router-view>
<v-data-table v-if="table" :headers="headers" :items="players" :items-per-page="-1" class="datatable elevation-1" density="compact" no-data-text="No Players found" sort-asc-icon="mdi-chevron-up" sort-desc-icon="mdi-chevron-down">
<v-data-table v-if="table" :headers="headers" :items="players" :items-per-page="-1" class="datatable elevation-0" density="compact" no-data-text="No Players found" sort-asc-icon="mdi-chevron-up" sort-desc-icon="mdi-chevron-down">
<template v-slot:item="{ item }">
<tr>
<td class="align-center justify-center">
Expand Down Expand Up @@ -86,23 +87,28 @@
<td v-if="headers.some((h) => h.title === 'FKDR')"><span v-html="item.columns.FKDRFormatted"></span></td>
<td v-if="headers.some((h) => h.title === 'BBLR')"><span v-html="item.columns.BBLRFormatted"></span></td>
<td>
<v-menu :close-on-content-click="false" v-if="item.columns.UUID !== undefined && item.columns.username.toLowerCase() !== dataStore.get('player').toLowerCase() && item.columns.UUID.toLowerCase() !== dataStore.get('player').replace(/-/g, '').toLowerCase()">
<v-menu>
<template v-slot:activator="{ props }">
<v-btn size="small" variant="text" :ripple="false" icon="mdi-dots-horizontal" v-bind="props"> </v-btn>
<v-btn size="small" variant="text" icon="mdi-dots-horizontal" v-bind="props" style="height: calc(var(--v-btn-height)) !important"> </v-btn>
</template>
<v-list>
<v-list-item v-if="item.columns.blacklisted === false">
<v-btn prepend-icon="mdi-flag-variant-plus" :loading="sendingCheatingReport" @click="reportPlayer(item.columns.UUID, 'cheater')">
<v-list-item>
<v-btn variant="flat" prepend-icon="mdi-chart-timeline-variant-shimmer" router-link to="/statistics" @click="viewStatistics(item.columns.UUID)">
<v-list-item-title>View Statistics</v-list-item-title>
</v-btn>
</v-list-item>
<v-list-item v-if="!item.columns.blacklisted && !item.columns.isYou">
<v-btn variant="flat" prepend-icon="mdi-flag-variant-plus" @click="reportPlayer(item.columns.UUID, 'cheater')">
<v-list-item-title>Report for Cheating</v-list-item-title>
</v-btn>
</v-list-item>
<v-list-item v-if="item.columns.blacklisted === false">
<v-btn prepend-icon="mdi-flag-variant-plus" :loading="sendingSnipingReport" @click="reportPlayer(item.columns.UUID, 'sniper')">
<v-list-item v-if="!item.columns.blacklisted && !item.columns.isYou">
<v-btn variant="flat" prepend-icon="mdi-flag-variant-plus" @click="reportPlayer(item.columns.UUID, 'sniper')">
<v-list-item-title>Report for Sniping</v-list-item-title>
</v-btn>
</v-list-item>
<v-list-item v-if="item.columns.blacklisted === true">
<v-btn prepend-icon="mdi-flag-variant-minus" :loading="revokeReport" @click="revokePlayerReport(item.columns.UUID)">
<v-list-item v-if="item.columns.blacklisted && !item.columns.isYou">
<v-btn variant="flat" prepend-icon="mdi-flag-variant-minus" @click="revokePlayerReport(item.columns.UUID)">
<v-list-item-title>Remove from Blacklist</v-list-item-title>
</v-btn>
</v-list-item>
Expand Down Expand Up @@ -234,20 +240,15 @@ const forceAddPlayer = (player) => {
}
};
var sendingCheatingReport = false;
var sendingSnipingReport = false;
const reportPlayer = (UUID, reason) => {
if (reason === "cheating") sendingCheatingReport = true;
if (reason === "sniping") sendingSnipingReport = true;
axios
.post(
"https://api.pixelic.de/hypixel/v1/overlay/reportsystem/report",
{},
{
params: {
UUID: UUID,
expire: dataStore.get("blacklistExpiry"),
expire: reason === "cheater" ? dataStore.get("blacklistCheaterExpiry") : dataStore.get("blacklistSniperExpiry"),
reason: reason,
},
headers: {
Expand All @@ -257,9 +258,6 @@ const reportPlayer = (UUID, reason) => {
}
)
.then(() => {
if (reason === "cheater") sendingCheatingReport = false;
if (reason === "sniper") sendingSnipingReport = false;
blacklistParser.add(UUID, reason);
sendNotification({
Expand All @@ -270,9 +268,6 @@ const reportPlayer = (UUID, reason) => {
});
})
.catch((error) => {
if (reason === "cheater") sendingCheatingReport = false;
if (reason === "sniper") sendingSnipingReport = false;
sendNotification({
timeout: 5000,
color: "error",
Expand Down Expand Up @@ -312,6 +307,13 @@ const revokePlayerReport = (UUID) => {
});
};
const viewStatistics = (UUID) => {
turnOffTable();
setTimeout(() => {
ipcRenderer.send("viewStatistics", UUID);
}, 1000);
};
setInterval(() => {
const Players = [];
for (var Player of getPlayers()) {
Expand Down Expand Up @@ -368,6 +370,7 @@ setInterval(() => {
}
Players.push({
isYou: Player.username.toLowerCase() === dataStore.get("player").toLowerCase() || Player.UUID.toLowerCase() === dataStore.get("player").replace(/-/g, "").toLowerCase(),
blacklisted: blacklisted,
UUID: Player.UUID,
username: Player.username,
Expand Down Expand Up @@ -412,7 +415,7 @@ const updateHeaders = () => {
{ title: "Name", align: "center", key: "formattedUsername", sortable: false, width: "25%" },
{ key: "fullUsername", align: " d-none" },
{ key: "UUID", align: " d-none" },
{ key: "username", align: " d-none" },
{ key: "isYou", align: " d-none" },
{ key: "blacklisted", align: " d-none" },
];
Expand Down
19 changes: 18 additions & 1 deletion src/data/dataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,27 @@ const store = new Store({
type: "boolean",
default: false,
},
blacklistExpiry: {
blacklistCheaterExpiry: {
type: "string",
default: "1y",
},
blacklistSniperExpiry: {
type: "string",
default: "30d",
},
blacklists: {
type: "array",
default: [
{
name: "Global",
enabled: false,
},
{
name: "Personal",
enabled: true,
},
],
},
colums: {
type: "array",
default: ["WS", "Wins", "WLR", "Finals", "FKDR", "BBLR"],
Expand Down
54 changes: 29 additions & 25 deletions src/misc/blacklistParser.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
import dataStore from "../data/dataStore";
import axios from "axios";

var parsedBlacklist = [];
var personalBlacklist = [];

const updateLists = async () => {
var lists = [];
const updatePersonalBlacklist = async () => {
var updatedList = [];
await axios
.get("https://api.pixelic.de/hypixel/v1/overlay/reportsystem/list/personal", { headers: { "X-API-Key": dataStore.get("pixelicKey"), "cache-control": "no-cache" } })
.then((res) => lists.push(res.data.reports))
.then((res) => {
updatedList = res.data.reports;
})
.catch(() => {});
personalBlacklist = updatedList;
};

// TODO: Add other extra custom blacklist from other people
var globalBlacklist = [];

var updatedLists = [];
for (const list of lists) {
for (const entry of list) {
const checkForDuplicate = updatedLists.some((e) => e.suspect === entry.suspect);
if (checkForDuplicate) {
if (checkForDuplicate.reason === "sniper" && entry.reason === "cheater") {
updatedLists[updatedLists.findIndex((e) => e.suspect === entry.suspect)].reason = "cheater";
}
} else {
updatedLists.push(entry);
}
}
}
parsedBlacklist = updatedLists;
const updateGlobalBlacklist = async () => {
var updatedList = [];
await axios
.get("https://api.pixelic.de/hypixel/v1/overlay/reportsystem/list/global", { headers: { "X-API-Key": dataStore.get("pixelicKey"), "cache-control": "no-cache" } })
.then((res) => {
updatedList = res.data.reports;
})
.catch(() => {});
globalBlacklist = updatedList;
};

updateLists().then(() => {});
const updateLists = () => {
if (dataStore.get("blacklists").some((l) => l.name === "Personal" && l.enabled === true)) updatePersonalBlacklist();
if (dataStore.get("blacklists").some((l) => l.name === "Global" && l.enabled === true)) updateGlobalBlacklist();
};

setInterval(async () => {
await updateLists();
updateLists();
setInterval(() => {
updateLists();
}, 60 * 1000);

export default {
add: (UUID, reason) => {
parsedBlacklist.push({ suspect: UUID, reason: reason });
personalBlacklist.push({ suspect: UUID, reason: reason });
},
remove: (UUID) => {
parsedBlacklist = parsedBlacklist.filter((p) => p.suspect !== UUID);
personalBlacklist = personalBlacklist.filter((p) => p.suspect !== UUID);
},
check: (UUID) => {
if (UUID === undefined) return null;
if (parsedBlacklist.some((p) => p.suspect === UUID)) return parsedBlacklist.find((p) => p.suspect === UUID).reason;
if (dataStore.get("blacklists").some((l) => l.name === "Personal" && l.enabled === true) && personalBlacklist.some((p) => p.suspect === UUID)) return personalBlacklist.find((p) => p.suspect === UUID).reason;
if (dataStore.get("blacklists").some((l) => l.name === "Global" && l.enabled === true) && globalBlacklist.some((p) => p.suspect === UUID)) return globalBlacklist.find((p) => p.suspect === UUID).reason;
return null;
},
};
12 changes: 6 additions & 6 deletions src/misc/discordRPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module.exports = {

client.setActivity({
instance: false,
details: `[${level}${star}] ${res.username}`,
state: `Lifetime » Wins: ${res.Bedwars.overall.wins.toLocaleString("en-US")} | Finals: ${res.Bedwars.overall.finalKills.toLocaleString("en-US")} | Beds: ${res.Bedwars.overall.bedsBroken.toLocaleString("en-US")}`,
details: `Lifetime » [${level}${star}] ${res.username}`,
state: `Wins: ${res.Bedwars.overall.wins.toLocaleString("en-US")} | Finals: ${res.Bedwars.overall.finalKills.toLocaleString("en-US")} | Beds: ${res.Bedwars.overall.bedsBroken.toLocaleString("en-US")}`,
startTimestamp,
largeImageKey: "pixelic",
largeImageText: `Pixelic-Overlay v${PackageJSON.version}`,
Expand Down Expand Up @@ -131,11 +131,11 @@ module.exports = {
};

if (Object.keys(modeData).length === 0) {
activity.details = `[0.00✫] ${res.username}`;
activity.state = `${mode} » Wins: 0 | Finals: 0 | Beds: 0`;
activity.details = `${mode} » [0.00✫] ${res.username}`;
activity.state = `Wins: 0 | Finals: 0 | Beds: 0`;
} else {
activity.details = `[${(res.Bedwars.level - modeData.Bedwars.level).toFixed(2)}✫] ${res.username}`;
activity.state = `${mode} » Wins: ${(res.Bedwars.overall.wins - modeData.Bedwars.overall.wins).toLocaleString("en-US")} | Finals: ${(res.Bedwars.overall.finalKills - modeData.Bedwars.overall.finalKills).toLocaleString("en-US")} | Beds: ${(res.Bedwars.overall.bedsBroken - modeData.Bedwars.overall.bedsBroken).toLocaleString("en-US")}`;
activity.details = `${mode} » [${(res.Bedwars.level - modeData.Bedwars.level).toFixed(2)}✫] ${res.username}`;
activity.state = `Wins: ${(res.Bedwars.overall.wins - modeData.Bedwars.overall.wins).toLocaleString("en-US")} | Finals: ${(res.Bedwars.overall.finalKills - modeData.Bedwars.overall.finalKills).toLocaleString("en-US")} | Beds: ${(res.Bedwars.overall.bedsBroken - modeData.Bedwars.overall.bedsBroken).toLocaleString("en-US")}`;
}

client.setActivity(activity);
Expand Down
2 changes: 1 addition & 1 deletion src/views/Settings/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<v-switch color="secondary" v-model="developerMode" @change="toggleDeveloperMode" style="display: flex"></v-switch>
</template>
<v-list-item-title>Developer Mode</v-list-item-title>
<v-list-item-subtitle>Do not enable this if you do not know what you are doing</v-list-item-subtitle>
<v-list-item-subtitle>Do not enable this if you do not know what you are doing!</v-list-item-subtitle>
</v-list-item>
</v-list>
</div>
Expand Down
Loading

0 comments on commit 395d7b0

Please sign in to comment.