Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Heroku を Free プランにしたのでアクセス時にサーバを起動する
Browse files Browse the repository at this point in the history
  • Loading branch information
calmery committed May 17, 2021
1 parent 8aacd7a commit c46da56
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/Exhibition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ExhibitionOkusuriLandNotifications } from "~/components/Exhibition/Okus
import { useMultiplay } from "~/hooks/exhibition/useMultuplay";
import { useScreenOrientation } from "~/hooks/exhibition/useScreenOrientation";
import { AreaName, GraphicsQuality } from "~/types/exhibition";
import { ping } from "~/utils/exhibition";
import * as GA from "~/utils/exhibition/google-analytics";
import * as state from "~/utils/exhibition/state";
import { useOkusuriLand } from "~/utils/okusuri.land";
Expand All @@ -32,6 +33,8 @@ export const Exhibition: React.FC = () => {
const [defaultArea, setDefaultArea] = useState<AreaName | null>(null);

useEffect(() => {
ping();

if (!state.exists()) {
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/cheki/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
getScenarioCacheId,
getTutorialElementId,
MouseRelatedEvent,
ping,
TouchRelatedEvent,
} from "~/utils/cheki";
import * as GA from "~/utils/cheki/google-analytics";
Expand Down Expand Up @@ -672,6 +673,7 @@ export const Index: NextPage = () => {
// Side Effects

useEffect(() => {
ping();
setTimeout(() => setFire(true), SPLASH_SCREEN_DURATION);
}, []);

Expand Down Expand Up @@ -714,7 +716,7 @@ export const Index: NextPage = () => {

{!splashed && (
<div css={fire ? splashAnimation : undefined}>
<div className="bg-white bottom-0 fixed flex h-full items-center justify-center left-0 right-0 top-0 w-full">
<div className="fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center w-full h-full bg-white">
<ChekiLogo size={256} />
<div className="absolute font-bold" css={splashComment}>
Made with <img css={splashHeart} src="/cheki/heart.svg" /> by
Expand Down
4 changes: 4 additions & 0 deletions src/utils/cheki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ export const getImageSizeByDirection = (direction: ChekiDirection) => ({
: CHEKI_VERTICAL_IMAGE_WIDTH,
});

export const ping = async (): Promise<void> => {
await fetch(getEndpointUrl(""));
};

export const upload = async (imageUrl: string): Promise<string> => {
const dataUrl = convertImageToDataUrl(await convertUrlToImage(imageUrl));
const formData = new FormData();
Expand Down
8 changes: 8 additions & 0 deletions src/utils/exhibition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ export const getScene = async (url: string) => {
return scene;
};

export const ping = async (): Promise<void> => {
await fetch(
process.env.NODE_ENV === "production"
? "https://multiplay.creamsoda.in/a/dream"
: "http://localhost:5000"
);
};

export const preload = (url: string) =>
axios.get(
`${
Expand Down

0 comments on commit c46da56

Please sign in to comment.