updated api calls with copyright and routes

This commit is contained in:
2023-02-16 12:53:08 +00:00
parent a25bded298
commit 9e66c069a6
10 changed files with 108 additions and 10 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"atlascode.bitbucket.enabled": true
}
+14 -1
View File
@@ -70,7 +70,20 @@ const ApiResponse = async (req, res) => {
ctx.textAlign = "left"; ctx.textAlign = "left";
ctx.font = "50px AmaticSC"; ctx.font = "50px AmaticSC";
//ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y);
ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); var copyrightSymbol = 169; // 0xA9
var $now = new Date();
var $yearCount = $now.getFullYear();
ctx.fillText(
String.fromCharCode(copyrightSymbol) +
" " +
"WWW.GETAHEADCHRISTMAS.CO.UK " +
" " +
$yearCount,
40,
740
);
$yearCount;
console.log(ctx); console.log(ctx);
+12 -2
View File
@@ -70,8 +70,18 @@ const ApiResponse = async (req, res) => {
ctx.textAlign = "left"; ctx.textAlign = "left";
ctx.font = "50px AmaticSC"; ctx.font = "50px AmaticSC";
//ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y);
ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); var copyrightSymbol = 169; // 0xA9
var $now = new Date();
var $yearCount = $now.getFullYear();
ctx.fillText(
String.fromCharCode(copyrightSymbol) +
" " +
"WWW.GETAHEADCHRISTMAS.CO.UK " +
" " +
$yearCount,
40,
740
);
console.log(ctx); console.log(ctx);
const png = canvas.toBuffer("image/png"); const png = canvas.toBuffer("image/png");
+12 -2
View File
@@ -62,8 +62,18 @@ const ApiResponse = async (req, res) => {
ctx.textAlign = "left"; ctx.textAlign = "left";
ctx.font = "50px AmaticSC"; ctx.font = "50px AmaticSC";
//ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y);
ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); var copyrightSymbol = 169; // 0xA9
var $now = new Date();
var $yearCount = $now.getFullYear();
ctx.fillText(
String.fromCharCode(copyrightSymbol) +
" " +
"WWW.GETAHEADCHRISTMAS.CO.UK " +
" " +
$yearCount,
40,
740
);
console.log(ctx); console.log(ctx);
const png = canvas.toBuffer("image/png"); const png = canvas.toBuffer("image/png");
+12 -1
View File
@@ -62,7 +62,18 @@ const ApiResponse = async (req, res) => {
ctx.textAlign = "left"; ctx.textAlign = "left";
ctx.font = "50px AmaticSC"; ctx.font = "50px AmaticSC";
//ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y);
ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); var copyrightSymbol = 169; // 0xA9
var $now = new Date();
var $yearCount = $now.getFullYear();
ctx.fillText(
String.fromCharCode(copyrightSymbol) +
" " +
"WWW.GETAHEADCHRISTMAS.CO.UK " +
" " +
$yearCount,
40,
740
);
console.log(ctx); console.log(ctx);
+1 -1
View File
@@ -8,7 +8,7 @@ import axios from "axios";
const FourOhFour = (props) => { const FourOhFour = (props) => {
const router = useRouter(); const router = useRouter();
let numbDays = router.query.n; let numbDays = router.query.days;
return ( return (
<div> <div>
<Image <Image
+51
View File
@@ -0,0 +1,51 @@
// 404.js
import Image from "next/image";
import { useRouter } from "next/router";
const FourOhFour = (props) => {
const router = useRouter();
let numbWeeks = router.query.weekstoday;
function addThousandsSeparator(e) {
return e.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
}
function countDownToChristmas() {
var $now = new Date();
var $yearCount = $now.getFullYear();
if ($now.getMonth() + 1 == 12 && $now.getDate() >= 25) {
$yearCount = $yearCount + 1;
}
var $xmas = new Date($yearCount, 11, 25);
var $now_seconds = Math.round($now.getTime() / 1e3);
var $xmas_seconds = Math.round($xmas.getTime() / 1e3);
var $seconds_to_go = $xmas_seconds - $now_seconds;
var $minutes_to_go = Math.round($seconds_to_go / 60);
var $hours_to_go = ($minutes_to_go / 60).toFixed(1);
var $days_to_go = ($hours_to_go / 24 - 1).toFixed();
var $sleeps_to_go = parseInt($days_to_go) + 1;
var $weeks_to_go = ($minutes_to_go / 60 / 24 / 7).toFixed(2);
var $fortnights_to_go = ($minutes_to_go / 60 / 24 / 7 / 2).toFixed(2);
var $months_to_go = ($weeks_to_go / (52 / 12)).toFixed(2);
var $years_to_go = ($weeks_to_go / 52).toFixed(2);
return $days_to_go;
}
return (
<div>
<Image
src={"/api/days/" + countDownToChristmas()}
width="940"
height="788"
alt="weeks"
/>
</div>
);
};
export default FourOhFour;
+1 -1
View File
@@ -6,7 +6,7 @@ import { useRouter } from "next/router";
const FourOhFour = (props) => { const FourOhFour = (props) => {
const router = useRouter(); const router = useRouter();
let numbSleeps = router.query.n; let numbSleeps = router.query.sleeps;
return ( return (
<div> <div>
<Image <Image
+1 -1
View File
@@ -6,7 +6,7 @@ import { useRouter } from "next/router";
const FourOhFour = (props) => { const FourOhFour = (props) => {
const router = useRouter(); const router = useRouter();
let numbWeeks = router.query.n; let numbWeeks = router.query.weeks;
return ( return (
<div> <div>
<Image <Image
@@ -6,7 +6,7 @@ import { useRouter } from "next/router";
const FourOhFour = (props) => { const FourOhFour = (props) => {
const router = useRouter(); const router = useRouter();
let numbWeeks = router.query.n; let numbWeeks = router.query.weekstoday;
return ( return (
<div> <div>
<Image <Image