Skip to content
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

[pull] master from monkeytypegame:master #572

Merged
merged 4 commits into from
Feb 27, 2025
Merged
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ backend/dist
backend/__migration__
docker
backend/scripts
backend/private
**/vitest.config.js
1 change: 1 addition & 0 deletions backend/private/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ <h1>API Server Configuration</h1>
<span id="form-loader" class="loader"></span>
</div>
<div id="save">Save Changes</div>
<div id="export">Export Configuration</div>
<script src="script.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions backend/private/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,27 @@ window.onload = async () => {
saveButton.disabled = false;
}, 3000);
});

const exportButton = document.querySelector("#export");

exportButton.addEventListener("click", async () => {
download(
"backend-configuration.json",
JSON.stringify({ configuration: state })
);
});
};

function download(filename, text) {
let element = document.createElement("a");
element.setAttribute(
"href",
"data:text/plain;charset=utf-8," + encodeURIComponent(text)
);
element.setAttribute("download", filename);

element.style.display = "none";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
10 changes: 8 additions & 2 deletions backend/private/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ body {
background-color: #d84b4b;
}

#save {
#save,
#export {
position: fixed;
right: 6rem;
bottom: 3rem;
Expand All @@ -90,7 +91,12 @@ body {
transition: 0.125s;
}

#save:hover {
#export {
bottom: 9rem;
}

#save:hover,
#export:hover {
background-color: var(--text-color);
color: var(--bg-color);
}
Expand Down
3 changes: 2 additions & 1 deletion docker/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ COPY --from=builder /prod/backend/node_modules /app/backend/node_modules
COPY --from=builder /prod/backend/dist /app/backend/dist
COPY --from=builder /prod/backend/email-templates /app/backend/email-templates
COPY --from=builder /prod/backend/redis-scripts /app/backend/redis-scripts
COPY --from=builder /prod/backend/private /app/backend/private

## to build directory
WORKDIR /app/backend/dist
Expand All @@ -38,7 +39,7 @@ RUN mkdir -p /app/backend/dist/logs

COPY ["docker/backend/entry-point.sh", "docker/backend/applyConfig.sh", "./"]

#run in env mode (no anticheat)
#run in dev mode (no anticheat)
ENV MODE=dev

EXPOSE 5005
Expand Down
4 changes: 2 additions & 2 deletions docs/SELF_HOSTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ If you don't want to update this file manually you can

- open the backend url in your browser, e.g. `http://localhost:5005/configure/`
- adjust the settings and click `Save Changes`
- open the configuration in your browser, e.g. `http://localhost:5005/configuration`
- copy everything from `data` into the `backend-configuration.json` file.
- click `Export Configuration`
- save the file as `backend-configuration.json`, overwriting the existing one.

Example output from `http://localhost:5005/configuration`:
```json
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/ts/event-handlers/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import * as QuoteReportModal from "../modals/quote-report";
import * as QuoteSearchModal from "../modals/quote-search";
import * as CustomTextModal from "../modals/custom-text";
import * as PractiseWordsModal from "../modals/practise-words";
import { navigate } from "../controllers/route-controller";
import { getMode2 } from "../utils/misc";

$(".pageTest").on("click", "#testModesNotice .textButton", async (event) => {
const attr = $(event.currentTarget).attr("commands");
Expand Down Expand Up @@ -84,3 +86,12 @@ $(".pageTest").on("click", "#practiseWordsButton", () => {
}
PractiseWordsModal.show();
});

$(".pageTest #dailyLeaderboardRank").on("click", async () => {
navigate(
`/leaderboards?type=daily&language=${Config.language}&mode2=${getMode2(
Config,
null
)}`
);
});
7 changes: 7 additions & 0 deletions frontend/static/themes/_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@
"subColor": "#2aa198",
"textColor": "#181819"
},
{
"name": "solarized_osaka",
"bgColor": "#00141a",
"mainColor": "#859900",
"subColor": "#2aa198",
"textColor": "#b58900"
},
{
"name": "terra",
"bgColor": "#0c100e",
Expand Down
56 changes: 56 additions & 0 deletions frontend/static/themes/solarized_osaka.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:root {
--bg-color: #00141a;
--main-color: #859900;
--caret-color: #b58900;
--sub-color: #2aa198;
--sub-alt-color: #00222b;
--text-color: #eee8d5;
--error-color: #dc322f;
--error-extra-color: #9b225c;
--colorful-error-color: #d33682;
--colorful-error-extra-color: #9b225c;
}

#words {
--correct-letter-color: var(--text-color);
--untyped-letter-color: #586e75;
}

header #logo {
color: var(--text-color);
}

header #logo .icon {
color: var(--text-color) !important;
}

key {
color: var(--text-color);
background-color: var(--sub-alt-color);
}

button.text:hover,
.button.text:hover,
.textButton:hover {
color: var(--caret-color);
}

button.text.active,
.button.text.active,
.textButton.active {
color: var(--main-color);
}

button:hover,
.button:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
input[type="submit"]:hover {
color: var(--bg-color);
background: var(--caret-color);
}

.scrollToTopButton:hover {
background: var(--caret-color);
color: var(--bg-color);
}
Loading