Small changes (kidding)
This commit is contained in:
@@ -15,6 +15,7 @@ email-validator = "*"
|
||||
python-multipart = "*"
|
||||
pydantic = "*"
|
||||
redis = "==4.2.0rc1"
|
||||
aiohttp = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
|
||||
Generated
+311
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "638d4341afa82b3e49972eebf51b7c451f25b3ec0bea06d0356eb237180654b6"
|
||||
"sha256": "f83f361f3f8db4da566116470b809811c0d9194b6b4372669778e9e3ef7f251a"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@@ -16,6 +16,92 @@
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"aiohttp": {
|
||||
"hashes": [
|
||||
"sha256:01d7bdb774a9acc838e6b8f1d114f45303841b89b95984cbb7d80ea41172a9e3",
|
||||
"sha256:03a6d5349c9ee8f79ab3ff3694d6ce1cfc3ced1c9d36200cb8f08ba06bd3b782",
|
||||
"sha256:04d48b8ce6ab3cf2097b1855e1505181bdd05586ca275f2505514a6e274e8e75",
|
||||
"sha256:0770e2806a30e744b4e21c9d73b7bee18a1cfa3c47991ee2e5a65b887c49d5cf",
|
||||
"sha256:07b05cd3305e8a73112103c834e91cd27ce5b4bd07850c4b4dbd1877d3f45be7",
|
||||
"sha256:086f92daf51a032d062ec5f58af5ca6a44d082c35299c96376a41cbb33034675",
|
||||
"sha256:099ebd2c37ac74cce10a3527d2b49af80243e2a4fa39e7bce41617fbc35fa3c1",
|
||||
"sha256:0c7ebbbde809ff4e970824b2b6cb7e4222be6b95a296e46c03cf050878fc1785",
|
||||
"sha256:102e487eeb82afac440581e5d7f8f44560b36cf0bdd11abc51a46c1cd88914d4",
|
||||
"sha256:11691cf4dc5b94236ccc609b70fec991234e7ef8d4c02dd0c9668d1e486f5abf",
|
||||
"sha256:11a67c0d562e07067c4e86bffc1553f2cf5b664d6111c894671b2b8712f3aba5",
|
||||
"sha256:12de6add4038df8f72fac606dff775791a60f113a725c960f2bab01d8b8e6b15",
|
||||
"sha256:13487abd2f761d4be7c8ff9080de2671e53fff69711d46de703c310c4c9317ca",
|
||||
"sha256:15b09b06dae900777833fe7fc4b4aa426556ce95847a3e8d7548e2d19e34edb8",
|
||||
"sha256:1c182cb873bc91b411e184dab7a2b664d4fea2743df0e4d57402f7f3fa644bac",
|
||||
"sha256:1ed0b6477896559f17b9eaeb6d38e07f7f9ffe40b9f0f9627ae8b9926ae260a8",
|
||||
"sha256:28d490af82bc6b7ce53ff31337a18a10498303fe66f701ab65ef27e143c3b0ef",
|
||||
"sha256:2e5d962cf7e1d426aa0e528a7e198658cdc8aa4fe87f781d039ad75dcd52c516",
|
||||
"sha256:2ed076098b171573161eb146afcb9129b5ff63308960aeca4b676d9d3c35e700",
|
||||
"sha256:2f2f69dca064926e79997f45b2f34e202b320fd3782f17a91941f7eb85502ee2",
|
||||
"sha256:31560d268ff62143e92423ef183680b9829b1b482c011713ae941997921eebc8",
|
||||
"sha256:31d1e1c0dbf19ebccbfd62eff461518dcb1e307b195e93bba60c965a4dcf1ba0",
|
||||
"sha256:37951ad2f4a6df6506750a23f7cbabad24c73c65f23f72e95897bb2cecbae676",
|
||||
"sha256:3af642b43ce56c24d063325dd2cf20ee012d2b9ba4c3c008755a301aaea720ad",
|
||||
"sha256:44db35a9e15d6fe5c40d74952e803b1d96e964f683b5a78c3cc64eb177878155",
|
||||
"sha256:473d93d4450880fe278696549f2e7aed8cd23708c3c1997981464475f32137db",
|
||||
"sha256:477c3ea0ba410b2b56b7efb072c36fa91b1e6fc331761798fa3f28bb224830dd",
|
||||
"sha256:4a4a4e30bf1edcad13fb0804300557aedd07a92cabc74382fdd0ba6ca2661091",
|
||||
"sha256:4aed991a28ea3ce320dc8ce655875e1e00a11bdd29fe9444dd4f88c30d558602",
|
||||
"sha256:51467000f3647d519272392f484126aa716f747859794ac9924a7aafa86cd411",
|
||||
"sha256:55c3d1072704d27401c92339144d199d9de7b52627f724a949fc7d5fc56d8b93",
|
||||
"sha256:589c72667a5febd36f1315aa6e5f56dd4aa4862df295cb51c769d16142ddd7cd",
|
||||
"sha256:5bfde62d1d2641a1f5173b8c8c2d96ceb4854f54a44c23102e2ccc7e02f003ec",
|
||||
"sha256:5c23b1ad869653bc818e972b7a3a79852d0e494e9ab7e1a701a3decc49c20d51",
|
||||
"sha256:61bfc23df345d8c9716d03717c2ed5e27374e0fe6f659ea64edcd27b4b044cf7",
|
||||
"sha256:6ae828d3a003f03ae31915c31fa684b9890ea44c9c989056fea96e3d12a9fa17",
|
||||
"sha256:6c7cefb4b0640703eb1069835c02486669312bf2f12b48a748e0a7756d0de33d",
|
||||
"sha256:6d69f36d445c45cda7b3b26afef2fc34ef5ac0cdc75584a87ef307ee3c8c6d00",
|
||||
"sha256:6f0d5f33feb5f69ddd57a4a4bd3d56c719a141080b445cbf18f238973c5c9923",
|
||||
"sha256:6f8b01295e26c68b3a1b90efb7a89029110d3a4139270b24fda961893216c440",
|
||||
"sha256:713ac174a629d39b7c6a3aa757b337599798da4c1157114a314e4e391cd28e32",
|
||||
"sha256:718626a174e7e467f0558954f94af117b7d4695d48eb980146016afa4b580b2e",
|
||||
"sha256:7187a76598bdb895af0adbd2fb7474d7f6025d170bc0a1130242da817ce9e7d1",
|
||||
"sha256:71927042ed6365a09a98a6377501af5c9f0a4d38083652bcd2281a06a5976724",
|
||||
"sha256:7d08744e9bae2ca9c382581f7dce1273fe3c9bae94ff572c3626e8da5b193c6a",
|
||||
"sha256:7dadf3c307b31e0e61689cbf9e06be7a867c563d5a63ce9dca578f956609abf8",
|
||||
"sha256:81e3d8c34c623ca4e36c46524a3530e99c0bc95ed068fd6e9b55cb721d408fb2",
|
||||
"sha256:844a9b460871ee0a0b0b68a64890dae9c415e513db0f4a7e3cab41a0f2fedf33",
|
||||
"sha256:8b7ef7cbd4fec9a1e811a5de813311ed4f7ac7d93e0fda233c9b3e1428f7dd7b",
|
||||
"sha256:97ef77eb6b044134c0b3a96e16abcb05ecce892965a2124c566af0fd60f717e2",
|
||||
"sha256:99b5eeae8e019e7aad8af8bb314fb908dd2e028b3cdaad87ec05095394cce632",
|
||||
"sha256:a25fa703a527158aaf10dafd956f7d42ac6d30ec80e9a70846253dd13e2f067b",
|
||||
"sha256:a2f635ce61a89c5732537a7896b6319a8fcfa23ba09bec36e1b1ac0ab31270d2",
|
||||
"sha256:a79004bb58748f31ae1cbe9fa891054baaa46fb106c2dc7af9f8e3304dc30316",
|
||||
"sha256:a996d01ca39b8dfe77440f3cd600825d05841088fd6bc0144cc6c2ec14cc5f74",
|
||||
"sha256:b0e20cddbd676ab8a64c774fefa0ad787cc506afd844de95da56060348021e96",
|
||||
"sha256:b6613280ccedf24354406caf785db748bebbddcf31408b20c0b48cb86af76866",
|
||||
"sha256:b9d00268fcb9f66fbcc7cd9fe423741d90c75ee029a1d15c09b22d23253c0a44",
|
||||
"sha256:bb01ba6b0d3f6c68b89fce7305080145d4877ad3acaed424bae4d4ee75faa950",
|
||||
"sha256:c2aef4703f1f2ddc6df17519885dbfa3514929149d3ff900b73f45998f2532fa",
|
||||
"sha256:c34dc4958b232ef6188c4318cb7b2c2d80521c9a56c52449f8f93ab7bc2a8a1c",
|
||||
"sha256:c3630c3ef435c0a7c549ba170a0633a56e92629aeed0e707fec832dee313fb7a",
|
||||
"sha256:c3d6a4d0619e09dcd61021debf7059955c2004fa29f48788a3dfaf9c9901a7cd",
|
||||
"sha256:d15367ce87c8e9e09b0f989bfd72dc641bcd04ba091c68cd305312d00962addd",
|
||||
"sha256:d2f9b69293c33aaa53d923032fe227feac867f81682f002ce33ffae978f0a9a9",
|
||||
"sha256:e999f2d0e12eea01caeecb17b653f3713d758f6dcc770417cf29ef08d3931421",
|
||||
"sha256:ea302f34477fda3f85560a06d9ebdc7fa41e82420e892fc50b577e35fc6a50b2",
|
||||
"sha256:eaba923151d9deea315be1f3e2b31cc39a6d1d2f682f942905951f4e40200922",
|
||||
"sha256:ef9612483cb35171d51d9173647eed5d0069eaa2ee812793a75373447d487aa4",
|
||||
"sha256:f5315a2eb0239185af1bddb1abf472d877fede3cc8d143c6cddad37678293237",
|
||||
"sha256:fa0ffcace9b3aa34d205d8130f7873fcfefcb6a4dd3dd705b0dab69af6712642",
|
||||
"sha256:fc5471e1a54de15ef71c1bc6ebe80d4dc681ea600e68bfd1cbce40427f0b7578"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==3.8.1"
|
||||
},
|
||||
"aiosignal": {
|
||||
"hashes": [
|
||||
"sha256:26e62109036cd181df6e6ad646f91f0dcfd05fe16d0cb924138ff2ab75d64e3a",
|
||||
"sha256:78ed67db6c7b7ced4f98e495e572106d5c432a93e1ddd1bf475e1dc05f5b7df2"
|
||||
],
|
||||
"markers": "python_version >= '3.6'",
|
||||
"version": "==1.2.0"
|
||||
},
|
||||
"aiosqlite": {
|
||||
"hashes": [
|
||||
"sha256:6c49dc6d3405929b1d08eeccc72306d3677503cc5e5e43771efc1e00232e8231",
|
||||
@@ -56,6 +142,14 @@
|
||||
"markers": "python_version >= '3.6'",
|
||||
"version": "==4.0.2"
|
||||
},
|
||||
"attrs": {
|
||||
"hashes": [
|
||||
"sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4",
|
||||
"sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
|
||||
"version": "==21.4.0"
|
||||
},
|
||||
"bidict": {
|
||||
"hashes": [
|
||||
"sha256:3ac67daa353ecf853a1df9d3e924f005e729227a60a8dbada31a4c31aba7f654",
|
||||
@@ -64,6 +158,14 @@
|
||||
"markers": "python_version >= '3.6'",
|
||||
"version": "==0.21.4"
|
||||
},
|
||||
"charset-normalizer": {
|
||||
"hashes": [
|
||||
"sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597",
|
||||
"sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"
|
||||
],
|
||||
"markers": "python_version >= '3.5'",
|
||||
"version": "==2.0.12"
|
||||
},
|
||||
"click": {
|
||||
"hashes": [
|
||||
"sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1",
|
||||
@@ -120,6 +222,71 @@
|
||||
"index": "pypi",
|
||||
"version": "==0.74.1"
|
||||
},
|
||||
"frozenlist": {
|
||||
"hashes": [
|
||||
"sha256:006d3595e7d4108a12025ddf415ae0f6c9e736e726a5db0183326fd191b14c5e",
|
||||
"sha256:01a73627448b1f2145bddb6e6c2259988bb8aee0fb361776ff8604b99616cd08",
|
||||
"sha256:03a7dd1bfce30216a3f51a84e6dd0e4a573d23ca50f0346634916ff105ba6e6b",
|
||||
"sha256:0437fe763fb5d4adad1756050cbf855bbb2bf0d9385c7bb13d7a10b0dd550486",
|
||||
"sha256:04cb491c4b1c051734d41ea2552fde292f5f3a9c911363f74f39c23659c4af78",
|
||||
"sha256:0c36e78b9509e97042ef869c0e1e6ef6429e55817c12d78245eb915e1cca7468",
|
||||
"sha256:25af28b560e0c76fa41f550eacb389905633e7ac02d6eb3c09017fa1c8cdfde1",
|
||||
"sha256:2fdc3cd845e5a1f71a0c3518528bfdbfe2efaf9886d6f49eacc5ee4fd9a10953",
|
||||
"sha256:30530930410855c451bea83f7b272fb1c495ed9d5cc72895ac29e91279401db3",
|
||||
"sha256:31977f84828b5bb856ca1eb07bf7e3a34f33a5cddce981d880240ba06639b94d",
|
||||
"sha256:3c62964192a1c0c30b49f403495911298810bada64e4f03249ca35a33ca0417a",
|
||||
"sha256:3f7c935c7b58b0d78c0beea0c7358e165f95f1fd8a7e98baa40d22a05b4a8141",
|
||||
"sha256:40dff8962b8eba91fd3848d857203f0bd704b5f1fa2b3fc9af64901a190bba08",
|
||||
"sha256:40ec383bc194accba825fbb7d0ef3dda5736ceab2375462f1d8672d9f6b68d07",
|
||||
"sha256:436496321dad302b8b27ca955364a439ed1f0999311c393dccb243e451ff66aa",
|
||||
"sha256:4406cfabef8f07b3b3af0f50f70938ec06d9f0fc26cbdeaab431cbc3ca3caeaa",
|
||||
"sha256:45334234ec30fc4ea677f43171b18a27505bfb2dba9aca4398a62692c0ea8868",
|
||||
"sha256:47be22dc27ed933d55ee55845d34a3e4e9f6fee93039e7f8ebadb0c2f60d403f",
|
||||
"sha256:4a44ebbf601d7bac77976d429e9bdb5a4614f9f4027777f9e54fd765196e9d3b",
|
||||
"sha256:4eda49bea3602812518765810af732229b4291d2695ed24a0a20e098c45a707b",
|
||||
"sha256:57f4d3f03a18facacb2a6bcd21bccd011e3b75d463dc49f838fd699d074fabd1",
|
||||
"sha256:603b9091bd70fae7be28bdb8aa5c9990f4241aa33abb673390a7f7329296695f",
|
||||
"sha256:65bc6e2fece04e2145ab6e3c47428d1bbc05aede61ae365b2c1bddd94906e478",
|
||||
"sha256:691ddf6dc50480ce49f68441f1d16a4c3325887453837036e0fb94736eae1e58",
|
||||
"sha256:6983a31698490825171be44ffbafeaa930ddf590d3f051e397143a5045513b01",
|
||||
"sha256:6a202458d1298ced3768f5a7d44301e7c86defac162ace0ab7434c2e961166e8",
|
||||
"sha256:6eb275c6385dd72594758cbe96c07cdb9bd6becf84235f4a594bdf21e3596c9d",
|
||||
"sha256:754728d65f1acc61e0f4df784456106e35afb7bf39cfe37227ab00436fb38676",
|
||||
"sha256:768efd082074bb203c934e83a61654ed4931ef02412c2fbdecea0cff7ecd0274",
|
||||
"sha256:772965f773757a6026dea111a15e6e2678fbd6216180f82a48a40b27de1ee2ab",
|
||||
"sha256:871d42623ae15eb0b0e9df65baeee6976b2e161d0ba93155411d58ff27483ad8",
|
||||
"sha256:88aafd445a233dbbf8a65a62bc3249a0acd0d81ab18f6feb461cc5a938610d24",
|
||||
"sha256:8c905a5186d77111f02144fab5b849ab524f1e876a1e75205cd1386a9be4b00a",
|
||||
"sha256:8cf829bd2e2956066dd4de43fd8ec881d87842a06708c035b37ef632930505a2",
|
||||
"sha256:92e650bd09b5dda929523b9f8e7f99b24deac61240ecc1a32aeba487afcd970f",
|
||||
"sha256:93641a51f89473837333b2f8100f3f89795295b858cd4c7d4a1f18e299dc0a4f",
|
||||
"sha256:94c7a8a9fc9383b52c410a2ec952521906d355d18fccc927fca52ab575ee8b93",
|
||||
"sha256:9f892d6a94ec5c7b785e548e42722e6f3a52f5f32a8461e82ac3e67a3bd073f1",
|
||||
"sha256:acb267b09a509c1df5a4ca04140da96016f40d2ed183cdc356d237286c971b51",
|
||||
"sha256:adac9700675cf99e3615eb6a0eb5e9f5a4143c7d42c05cea2e7f71c27a3d0846",
|
||||
"sha256:aff388be97ef2677ae185e72dc500d19ecaf31b698986800d3fc4f399a5e30a5",
|
||||
"sha256:b5009062d78a8c6890d50b4e53b0ddda31841b3935c1937e2ed8c1bda1c7fb9d",
|
||||
"sha256:b684c68077b84522b5c7eafc1dc735bfa5b341fb011d5552ebe0968e22ed641c",
|
||||
"sha256:b9e3e9e365991f8cc5f5edc1fd65b58b41d0514a6a7ad95ef5c7f34eb49b3d3e",
|
||||
"sha256:bd89acd1b8bb4f31b47072615d72e7f53a948d302b7c1d1455e42622de180eae",
|
||||
"sha256:bde99812f237f79eaf3f04ebffd74f6718bbd216101b35ac7955c2d47c17da02",
|
||||
"sha256:c6c321dd013e8fc20735b92cb4892c115f5cdb82c817b1e5b07f6b95d952b2f0",
|
||||
"sha256:ce6f2ba0edb7b0c1d8976565298ad2deba6f8064d2bebb6ffce2ca896eb35b0b",
|
||||
"sha256:d2257aaba9660f78c7b1d8fea963b68f3feffb1a9d5d05a18401ca9eb3e8d0a3",
|
||||
"sha256:d26b650b71fdc88065b7a21f8ace70175bcf3b5bdba5ea22df4bfd893e795a3b",
|
||||
"sha256:d6d32ff213aef0fd0bcf803bffe15cfa2d4fde237d1d4838e62aec242a8362fa",
|
||||
"sha256:e1e26ac0a253a2907d654a37e390904426d5ae5483150ce3adedb35c8c06614a",
|
||||
"sha256:e30b2f9683812eb30cf3f0a8e9f79f8d590a7999f731cf39f9105a7c4a39489d",
|
||||
"sha256:e84cb61b0ac40a0c3e0e8b79c575161c5300d1d89e13c0e02f76193982f066ed",
|
||||
"sha256:e982878792c971cbd60ee510c4ee5bf089a8246226dea1f2138aa0bb67aff148",
|
||||
"sha256:f20baa05eaa2bcd5404c445ec51aed1c268d62600362dc6cfe04fae34a424bd9",
|
||||
"sha256:f7353ba3367473d1d616ee727945f439e027f0bb16ac1a750219a8344d1d5d3c",
|
||||
"sha256:f96293d6f982c58ebebb428c50163d010c2f05de0cde99fd681bfdc18d4b2dc2",
|
||||
"sha256:ff9310f05b9d9c5c4dd472983dc956901ee6cb2c3ec1ab116ecdde25f3ce4951"
|
||||
],
|
||||
"markers": "python_version >= '3.7'",
|
||||
"version": "==1.3.0"
|
||||
},
|
||||
"greenlet": {
|
||||
"hashes": [
|
||||
"sha256:0051c6f1f27cb756ffc0ffbac7d2cd48cb0362ac1736871399a739b2885134d3",
|
||||
@@ -280,6 +447,71 @@
|
||||
"markers": "python_version >= '3.7'",
|
||||
"version": "==2.1.0"
|
||||
},
|
||||
"multidict": {
|
||||
"hashes": [
|
||||
"sha256:0327292e745a880459ef71be14e709aaea2f783f3537588fb4ed09b6c01bca60",
|
||||
"sha256:041b81a5f6b38244b34dc18c7b6aba91f9cdaf854d9a39e5ff0b58e2b5773b9c",
|
||||
"sha256:0556a1d4ea2d949efe5fd76a09b4a82e3a4a30700553a6725535098d8d9fb672",
|
||||
"sha256:05f6949d6169878a03e607a21e3b862eaf8e356590e8bdae4227eedadacf6e51",
|
||||
"sha256:07a017cfa00c9890011628eab2503bee5872f27144936a52eaab449be5eaf032",
|
||||
"sha256:0b9e95a740109c6047602f4db4da9949e6c5945cefbad34a1299775ddc9a62e2",
|
||||
"sha256:19adcfc2a7197cdc3987044e3f415168fc5dc1f720c932eb1ef4f71a2067e08b",
|
||||
"sha256:19d9bad105dfb34eb539c97b132057a4e709919ec4dd883ece5838bcbf262b80",
|
||||
"sha256:225383a6603c086e6cef0f2f05564acb4f4d5f019a4e3e983f572b8530f70c88",
|
||||
"sha256:23b616fdc3c74c9fe01d76ce0d1ce872d2d396d8fa8e4899398ad64fb5aa214a",
|
||||
"sha256:2957489cba47c2539a8eb7ab32ff49101439ccf78eab724c828c1a54ff3ff98d",
|
||||
"sha256:2d36e929d7f6a16d4eb11b250719c39560dd70545356365b494249e2186bc389",
|
||||
"sha256:2e4a0785b84fb59e43c18a015ffc575ba93f7d1dbd272b4cdad9f5134b8a006c",
|
||||
"sha256:3368bf2398b0e0fcbf46d85795adc4c259299fec50c1416d0f77c0a843a3eed9",
|
||||
"sha256:373ba9d1d061c76462d74e7de1c0c8e267e9791ee8cfefcf6b0b2495762c370c",
|
||||
"sha256:4070613ea2227da2bfb2c35a6041e4371b0af6b0be57f424fe2318b42a748516",
|
||||
"sha256:45183c96ddf61bf96d2684d9fbaf6f3564d86b34cb125761f9a0ef9e36c1d55b",
|
||||
"sha256:4571f1beddff25f3e925eea34268422622963cd8dc395bb8778eb28418248e43",
|
||||
"sha256:47e6a7e923e9cada7c139531feac59448f1f47727a79076c0b1ee80274cd8eee",
|
||||
"sha256:47fbeedbf94bed6547d3aa632075d804867a352d86688c04e606971595460227",
|
||||
"sha256:497988d6b6ec6ed6f87030ec03280b696ca47dbf0648045e4e1d28b80346560d",
|
||||
"sha256:4bae31803d708f6f15fd98be6a6ac0b6958fcf68fda3c77a048a4f9073704aae",
|
||||
"sha256:50bd442726e288e884f7be9071016c15a8742eb689a593a0cac49ea093eef0a7",
|
||||
"sha256:514fe2b8d750d6cdb4712346a2c5084a80220821a3e91f3f71eec11cf8d28fd4",
|
||||
"sha256:5774d9218d77befa7b70d836004a768fb9aa4fdb53c97498f4d8d3f67bb9cfa9",
|
||||
"sha256:5fdda29a3c7e76a064f2477c9aab1ba96fd94e02e386f1e665bca1807fc5386f",
|
||||
"sha256:5ff3bd75f38e4c43f1f470f2df7a4d430b821c4ce22be384e1459cb57d6bb013",
|
||||
"sha256:626fe10ac87851f4cffecee161fc6f8f9853f0f6f1035b59337a51d29ff3b4f9",
|
||||
"sha256:6701bf8a5d03a43375909ac91b6980aea74b0f5402fbe9428fc3f6edf5d9677e",
|
||||
"sha256:684133b1e1fe91eda8fa7447f137c9490a064c6b7f392aa857bba83a28cfb693",
|
||||
"sha256:6f3cdef8a247d1eafa649085812f8a310e728bdf3900ff6c434eafb2d443b23a",
|
||||
"sha256:75bdf08716edde767b09e76829db8c1e5ca9d8bb0a8d4bd94ae1eafe3dac5e15",
|
||||
"sha256:7c40b7bbece294ae3a87c1bc2abff0ff9beef41d14188cda94ada7bcea99b0fb",
|
||||
"sha256:8004dca28e15b86d1b1372515f32eb6f814bdf6f00952699bdeb541691091f96",
|
||||
"sha256:8064b7c6f0af936a741ea1efd18690bacfbae4078c0c385d7c3f611d11f0cf87",
|
||||
"sha256:89171b2c769e03a953d5969b2f272efa931426355b6c0cb508022976a17fd376",
|
||||
"sha256:8cbf0132f3de7cc6c6ce00147cc78e6439ea736cee6bca4f068bcf892b0fd658",
|
||||
"sha256:9cc57c68cb9139c7cd6fc39f211b02198e69fb90ce4bc4a094cf5fe0d20fd8b0",
|
||||
"sha256:a007b1638e148c3cfb6bf0bdc4f82776cef0ac487191d093cdc316905e504071",
|
||||
"sha256:a2c34a93e1d2aa35fbf1485e5010337c72c6791407d03aa5f4eed920343dd360",
|
||||
"sha256:a45e1135cb07086833ce969555df39149680e5471c04dfd6a915abd2fc3f6dbc",
|
||||
"sha256:ac0e27844758d7177989ce406acc6a83c16ed4524ebc363c1f748cba184d89d3",
|
||||
"sha256:aef9cc3d9c7d63d924adac329c33835e0243b5052a6dfcbf7732a921c6e918ba",
|
||||
"sha256:b9d153e7f1f9ba0b23ad1568b3b9e17301e23b042c23870f9ee0522dc5cc79e8",
|
||||
"sha256:bfba7c6d5d7c9099ba21f84662b037a0ffd4a5e6b26ac07d19e423e6fdf965a9",
|
||||
"sha256:c207fff63adcdf5a485969131dc70e4b194327666b7e8a87a97fbc4fd80a53b2",
|
||||
"sha256:d0509e469d48940147e1235d994cd849a8f8195e0bca65f8f5439c56e17872a3",
|
||||
"sha256:d16cce709ebfadc91278a1c005e3c17dd5f71f5098bfae1035149785ea6e9c68",
|
||||
"sha256:d48b8ee1d4068561ce8033d2c344cf5232cb29ee1a0206a7b828c79cbc5982b8",
|
||||
"sha256:de989b195c3d636ba000ee4281cd03bb1234635b124bf4cd89eeee9ca8fcb09d",
|
||||
"sha256:e07c8e79d6e6fd37b42f3250dba122053fddb319e84b55dd3a8d6446e1a7ee49",
|
||||
"sha256:e2c2e459f7050aeb7c1b1276763364884595d47000c1cddb51764c0d8976e608",
|
||||
"sha256:e5b20e9599ba74391ca0cfbd7b328fcc20976823ba19bc573983a25b32e92b57",
|
||||
"sha256:e875b6086e325bab7e680e4316d667fc0e5e174bb5611eb16b3ea121c8951b86",
|
||||
"sha256:f4f052ee022928d34fe1f4d2bc743f32609fb79ed9c49a1710a5ad6b2198db20",
|
||||
"sha256:fcb91630817aa8b9bc4a74023e4198480587269c272c58b3279875ed7235c293",
|
||||
"sha256:fd9fc9c4849a07f3635ccffa895d57abce554b467d611a5009ba4f39b78a8849",
|
||||
"sha256:feba80698173761cddd814fa22e88b0661e98cb810f9f986c54aa34d281e4937",
|
||||
"sha256:feea820722e69451743a3d56ad74948b68bf456984d63c1a92e8347b7b88452d"
|
||||
],
|
||||
"markers": "python_version >= '3.7'",
|
||||
"version": "==6.0.2"
|
||||
},
|
||||
"ormar": {
|
||||
"hashes": [
|
||||
"sha256:0ac7765bc14237cb4ed828c823cae3a4a9f5dea6daa402e0999c80b36662c410",
|
||||
@@ -685,6 +917,84 @@
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
|
||||
"version": "==1.13.3"
|
||||
},
|
||||
"yarl": {
|
||||
"hashes": [
|
||||
"sha256:044daf3012e43d4b3538562da94a88fb12a6490652dbc29fb19adfa02cf72eac",
|
||||
"sha256:0cba38120db72123db7c58322fa69e3c0efa933040ffb586c3a87c063ec7cae8",
|
||||
"sha256:167ab7f64e409e9bdd99333fe8c67b5574a1f0495dcfd905bc7454e766729b9e",
|
||||
"sha256:1be4bbb3d27a4e9aa5f3df2ab61e3701ce8fcbd3e9846dbce7c033a7e8136746",
|
||||
"sha256:1ca56f002eaf7998b5fcf73b2421790da9d2586331805f38acd9997743114e98",
|
||||
"sha256:1d3d5ad8ea96bd6d643d80c7b8d5977b4e2fb1bab6c9da7322616fd26203d125",
|
||||
"sha256:1eb6480ef366d75b54c68164094a6a560c247370a68c02dddb11f20c4c6d3c9d",
|
||||
"sha256:1edc172dcca3f11b38a9d5c7505c83c1913c0addc99cd28e993efeaafdfaa18d",
|
||||
"sha256:211fcd65c58bf250fb994b53bc45a442ddc9f441f6fec53e65de8cba48ded986",
|
||||
"sha256:29e0656d5497733dcddc21797da5a2ab990c0cb9719f1f969e58a4abac66234d",
|
||||
"sha256:368bcf400247318382cc150aaa632582d0780b28ee6053cd80268c7e72796dec",
|
||||
"sha256:39d5493c5ecd75c8093fa7700a2fb5c94fe28c839c8e40144b7ab7ccba6938c8",
|
||||
"sha256:3abddf0b8e41445426d29f955b24aeecc83fa1072be1be4e0d194134a7d9baee",
|
||||
"sha256:3bf8cfe8856708ede6a73907bf0501f2dc4e104085e070a41f5d88e7faf237f3",
|
||||
"sha256:3ec1d9a0d7780416e657f1e405ba35ec1ba453a4f1511eb8b9fbab81cb8b3ce1",
|
||||
"sha256:45399b46d60c253327a460e99856752009fcee5f5d3c80b2f7c0cae1c38d56dd",
|
||||
"sha256:52690eb521d690ab041c3919666bea13ab9fbff80d615ec16fa81a297131276b",
|
||||
"sha256:534b047277a9a19d858cde163aba93f3e1677d5acd92f7d10ace419d478540de",
|
||||
"sha256:580c1f15500e137a8c37053e4cbf6058944d4c114701fa59944607505c2fe3a0",
|
||||
"sha256:59218fef177296451b23214c91ea3aba7858b4ae3306dde120224cfe0f7a6ee8",
|
||||
"sha256:5ba63585a89c9885f18331a55d25fe81dc2d82b71311ff8bd378fc8004202ff6",
|
||||
"sha256:5bb7d54b8f61ba6eee541fba4b83d22b8a046b4ef4d8eb7f15a7e35db2e1e245",
|
||||
"sha256:6152224d0a1eb254f97df3997d79dadd8bb2c1a02ef283dbb34b97d4f8492d23",
|
||||
"sha256:67e94028817defe5e705079b10a8438b8cb56e7115fa01640e9c0bb3edf67332",
|
||||
"sha256:695ba021a9e04418507fa930d5f0704edbce47076bdcfeeaba1c83683e5649d1",
|
||||
"sha256:6a1a9fe17621af43e9b9fcea8bd088ba682c8192d744b386ee3c47b56eaabb2c",
|
||||
"sha256:6ab0c3274d0a846840bf6c27d2c60ba771a12e4d7586bf550eefc2df0b56b3b4",
|
||||
"sha256:6feca8b6bfb9eef6ee057628e71e1734caf520a907b6ec0d62839e8293e945c0",
|
||||
"sha256:737e401cd0c493f7e3dd4db72aca11cfe069531c9761b8ea474926936b3c57c8",
|
||||
"sha256:788713c2896f426a4e166b11f4ec538b5736294ebf7d5f654ae445fd44270832",
|
||||
"sha256:797c2c412b04403d2da075fb93c123df35239cd7b4cc4e0cd9e5839b73f52c58",
|
||||
"sha256:8300401dc88cad23f5b4e4c1226f44a5aa696436a4026e456fe0e5d2f7f486e6",
|
||||
"sha256:87f6e082bce21464857ba58b569370e7b547d239ca22248be68ea5d6b51464a1",
|
||||
"sha256:89ccbf58e6a0ab89d487c92a490cb5660d06c3a47ca08872859672f9c511fc52",
|
||||
"sha256:8b0915ee85150963a9504c10de4e4729ae700af11df0dc5550e6587ed7891e92",
|
||||
"sha256:8cce6f9fa3df25f55521fbb5c7e4a736683148bcc0c75b21863789e5185f9185",
|
||||
"sha256:95a1873b6c0dd1c437fb3bb4a4aaa699a48c218ac7ca1e74b0bee0ab16c7d60d",
|
||||
"sha256:9b4c77d92d56a4c5027572752aa35082e40c561eec776048330d2907aead891d",
|
||||
"sha256:9bfcd43c65fbb339dc7086b5315750efa42a34eefad0256ba114cd8ad3896f4b",
|
||||
"sha256:9c1f083e7e71b2dd01f7cd7434a5f88c15213194df38bc29b388ccdf1492b739",
|
||||
"sha256:a1d0894f238763717bdcfea74558c94e3bc34aeacd3351d769460c1a586a8b05",
|
||||
"sha256:a467a431a0817a292121c13cbe637348b546e6ef47ca14a790aa2fa8cc93df63",
|
||||
"sha256:aa32aaa97d8b2ed4e54dc65d241a0da1c627454950f7d7b1f95b13985afd6c5d",
|
||||
"sha256:ac10bbac36cd89eac19f4e51c032ba6b412b3892b685076f4acd2de18ca990aa",
|
||||
"sha256:ac35ccde589ab6a1870a484ed136d49a26bcd06b6a1c6397b1967ca13ceb3913",
|
||||
"sha256:bab827163113177aee910adb1f48ff7af31ee0289f434f7e22d10baf624a6dfe",
|
||||
"sha256:baf81561f2972fb895e7844882898bda1eef4b07b5b385bcd308d2098f1a767b",
|
||||
"sha256:bf19725fec28452474d9887a128e98dd67eee7b7d52e932e6949c532d820dc3b",
|
||||
"sha256:c01a89a44bb672c38f42b49cdb0ad667b116d731b3f4c896f72302ff77d71656",
|
||||
"sha256:c0910c6b6c31359d2f6184828888c983d54d09d581a4a23547a35f1d0b9484b1",
|
||||
"sha256:c10ea1e80a697cf7d80d1ed414b5cb8f1eec07d618f54637067ae3c0334133c4",
|
||||
"sha256:c1164a2eac148d85bbdd23e07dfcc930f2e633220f3eb3c3e2a25f6148c2819e",
|
||||
"sha256:c145ab54702334c42237a6c6c4cc08703b6aa9b94e2f227ceb3d477d20c36c63",
|
||||
"sha256:c17965ff3706beedafd458c452bf15bac693ecd146a60a06a214614dc097a271",
|
||||
"sha256:c19324a1c5399b602f3b6e7db9478e5b1adf5cf58901996fc973fe4fccd73eed",
|
||||
"sha256:c2a1ac41a6aa980db03d098a5531f13985edcb451bcd9d00670b03129922cd0d",
|
||||
"sha256:c6ddcd80d79c96eb19c354d9dca95291589c5954099836b7c8d29278a7ec0bda",
|
||||
"sha256:c9c6d927e098c2d360695f2e9d38870b2e92e0919be07dbe339aefa32a090265",
|
||||
"sha256:cc8b7a7254c0fc3187d43d6cb54b5032d2365efd1df0cd1749c0c4df5f0ad45f",
|
||||
"sha256:cff3ba513db55cc6a35076f32c4cdc27032bd075c9faef31fec749e64b45d26c",
|
||||
"sha256:d260d4dc495c05d6600264a197d9d6f7fc9347f21d2594926202fd08cf89a8ba",
|
||||
"sha256:d6f3d62e16c10e88d2168ba2d065aa374e3c538998ed04996cd373ff2036d64c",
|
||||
"sha256:da6df107b9ccfe52d3a48165e48d72db0eca3e3029b5b8cb4fe6ee3cb870ba8b",
|
||||
"sha256:dfe4b95b7e00c6635a72e2d00b478e8a28bfb122dc76349a06e20792eb53a523",
|
||||
"sha256:e39378894ee6ae9f555ae2de332d513a5763276a9265f8e7cbaeb1b1ee74623a",
|
||||
"sha256:ede3b46cdb719c794427dcce9d8beb4abe8b9aa1e97526cc20de9bd6583ad1ef",
|
||||
"sha256:f2a8508f7350512434e41065684076f640ecce176d262a7d54f0da41d99c5a95",
|
||||
"sha256:f44477ae29025d8ea87ec308539f95963ffdc31a82f42ca9deecf2d505242e72",
|
||||
"sha256:f64394bd7ceef1237cc604b5a89bf748c95982a84bcd3c4bbeb40f685c810794",
|
||||
"sha256:fc4dd8b01a8112809e6b636b00f487846956402834a7fd59d46d4f4267181c41",
|
||||
"sha256:fce78593346c014d0d986b7ebc80d782b7f5e19843ca798ed62f8e3ba8728576",
|
||||
"sha256:fd547ec596d90c8676e369dd8a581a21227fe9b4ad37d0dc7feb4ccf544c2d59"
|
||||
],
|
||||
"markers": "python_version >= '3.6'",
|
||||
"version": "==1.7.2"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
|
||||
@@ -77,9 +77,10 @@ async def register_as_admin(sid, data):
|
||||
@sio.event
|
||||
async def get_question_results(sid, data):
|
||||
session = await sio.get_session(sid)
|
||||
redis_res = await redis.get(f"game_session:{session['game_pin']}:{data['question_number']}")
|
||||
game_pin = session['game_pin']
|
||||
await sio.emit("question_results", redis_res, room=game_pin)
|
||||
if session["admin"]:
|
||||
redis_res = await redis.get(f"game_session:{session['game_pin']}:{data['question_number']}")
|
||||
game_pin = session['game_pin']
|
||||
await sio.emit("question_results", redis_res, room=game_pin)
|
||||
|
||||
|
||||
@sio.event
|
||||
|
||||
Generated
+3113
-2286
File diff suppressed because it is too large
Load Diff
Vendored
+6
-1
@@ -9,7 +9,6 @@ declare namespace App {
|
||||
authenticated: boolean;
|
||||
token: string | null;
|
||||
email: string | null;
|
||||
|
||||
}
|
||||
|
||||
// interface Stuff {}
|
||||
@@ -35,3 +34,9 @@ export interface Answer {
|
||||
right: boolean;
|
||||
answer: string;
|
||||
}
|
||||
|
||||
export interface Answer {
|
||||
username: string;
|
||||
answer: string;
|
||||
right: boolean;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as cookie from 'cookie';
|
||||
import fetch from 'node-fetch';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
|
||||
const redis = new Redis(process.env.REDIS_URL);
|
||||
|
||||
/** @type {import('@sveltejs/kit').Handle} */
|
||||
@@ -31,12 +30,11 @@ export async function getSession(event) {
|
||||
});
|
||||
if (res.ok) {
|
||||
const json = await res.json();
|
||||
// @ts-ignore
|
||||
//@ts-ignore
|
||||
user_email = json.email;
|
||||
} else {
|
||||
user_email = null;
|
||||
}
|
||||
|
||||
} else {
|
||||
user_email = redis_res;
|
||||
}
|
||||
@@ -53,5 +51,4 @@ export async function getSession(event) {
|
||||
email: user_email
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<script lang="ts">
|
||||
import { socket } from '$lib/socket';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { browser } from '$app/env';
|
||||
|
||||
export let game_pin: string;
|
||||
|
||||
let username = '';
|
||||
let hcaptchaSitekey = 'ee81b2a1-acf3-4d20-b2a4-a7ea94c7eba5';
|
||||
|
||||
let hcaptcha = {
|
||||
execute: async (_a, _b) => ({ response: '' }),
|
||||
render: (_a, _b) => {}
|
||||
};
|
||||
let hcaptchaWidgetID;
|
||||
|
||||
onMount(() => {
|
||||
if (browser) {
|
||||
hcaptcha = window.hcaptcha;
|
||||
if (hcaptcha.render) {
|
||||
hcaptchaWidgetID = hcaptcha.render('hcaptcha', {
|
||||
sitekey: hcaptchaSitekey,
|
||||
size: 'invisible',
|
||||
theme: 'dark'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (browser) {
|
||||
hcaptcha = {
|
||||
execute: async () => ({ response: '' }),
|
||||
render: () => {}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const setUsername = async () => {
|
||||
if (username.length <= 3) {
|
||||
return;
|
||||
}
|
||||
const { response } = await hcaptcha.execute(hcaptchaWidgetID, {
|
||||
async: true
|
||||
});
|
||||
socket.emit('join_game', {
|
||||
username: username,
|
||||
game_pin: game_pin,
|
||||
captcha: response
|
||||
});
|
||||
};
|
||||
socket.on('game_not_found', () => {
|
||||
alert('Game not found');
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<script src="https://js.hcaptcha.com/1/api.js?render=explicit" async defer></script>
|
||||
</svelte:head>
|
||||
|
||||
{#if game_pin === '' || game_pin.length <= 7}
|
||||
<div class="flex flex-col justify-center align-center w-screen h-screen">
|
||||
<form
|
||||
on:submit|preventDefault={() => {}}
|
||||
class="flex-col flex justify-center align-center mx-auto"
|
||||
>
|
||||
<h1 class="text-lg text-center">Game Pin</h1>
|
||||
<input
|
||||
class="border border-amber-800 self-center text-center"
|
||||
bind:value={game_pin}
|
||||
maxlength="8"
|
||||
/>
|
||||
<br />
|
||||
<button
|
||||
class="bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded"
|
||||
type="submit"
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex flex-col justify-center align-center w-screen h-screen">
|
||||
<form
|
||||
on:submit|preventDefault={setUsername}
|
||||
class="flex-col flex justify-center align-center mx-auto"
|
||||
>
|
||||
<h1 class="text-lg text-center">Username</h1>
|
||||
<input class="border border-amber-800" bind:value={username} />
|
||||
<button
|
||||
class="bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded disabled:cursor-not-allowed disabled:opacity-50"
|
||||
type="submit"
|
||||
disabled={username.length <= 3}
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
id="hcaptcha"
|
||||
class="h-captcha"
|
||||
data-sitekey={hcaptchaSitekey}
|
||||
data-size="invisible"
|
||||
data-theme="dark"
|
||||
/>
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
import type { Question } from '../../app';
|
||||
import { socket } from '$lib/socket';
|
||||
|
||||
@@ -11,13 +11,10 @@
|
||||
throw new Error('question_index must be a string or number');
|
||||
}
|
||||
|
||||
|
||||
let timer_res = question.time;
|
||||
let selected_answer: string;
|
||||
|
||||
|
||||
// Stop the timer if the question is answered
|
||||
let timer_interval;
|
||||
const timer = (time: string) => {
|
||||
let seconds = Number(time);
|
||||
let timer_interval = setInterval(() => {
|
||||
@@ -31,8 +28,7 @@
|
||||
timer_res = seconds.toString();
|
||||
}, 1000);
|
||||
};
|
||||
console.log(selected_answer)
|
||||
|
||||
console.log(selected_answer);
|
||||
|
||||
timer(question.time);
|
||||
|
||||
@@ -44,34 +40,40 @@
|
||||
answer: answer
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<div class='flex flex-col justify-center w-screen h-1/6'>
|
||||
<h1 class='text-6xl text-center'>
|
||||
<div class="flex flex-col justify-center w-screen h-1/6">
|
||||
<h1 class="text-6xl text-center">
|
||||
{question.question}
|
||||
</h1>
|
||||
<span class='text-center py-2 text-lg'>{timer_res}</span>
|
||||
<span class="text-center py-2 text-lg">{timer_res}</span>
|
||||
</div>
|
||||
{#if timer_res !== "0"}
|
||||
<div class='flex flex-wrap'>
|
||||
{#if timer_res !== '0'}
|
||||
<div class="flex flex-wrap">
|
||||
{#each question.answers as answer}
|
||||
<button class='w-1/2 text-3xl bg-amber-700 my-2 disabled:opacity-60 border border-white' disabled={selected_answer !== undefined}
|
||||
on:click={() => selectAnswer(answer.answer)}>{answer.answer}</button>
|
||||
<button
|
||||
class="w-1/2 text-3xl bg-amber-700 my-2 disabled:opacity-60 border border-white"
|
||||
disabled={selected_answer !== undefined}
|
||||
on:click={() => selectAnswer(answer.answer)}>{answer.answer}</button
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<div class='flex flex-wrap'>
|
||||
<div class="flex flex-wrap">
|
||||
{#each question.answers as answer}
|
||||
{#if answer.right}
|
||||
<button class='w-1/2 text-3xl bg-green-600 border border-white' disabled
|
||||
class:opacity-30={answer.answer !== selected_answer}
|
||||
>{answer.answer}</button>
|
||||
{:else }
|
||||
<button class='w-1/2 text-3xl bg-red-500 border border-white' disabled
|
||||
class:opacity-30={answer.answer !== selected_answer}
|
||||
>{answer.answer}</button>
|
||||
<button
|
||||
class="w-1/2 text-3xl bg-green-600 border border-white"
|
||||
disabled
|
||||
class:opacity-30={answer.answer !== selected_answer}>{answer.answer}</button
|
||||
>
|
||||
{:else}
|
||||
<button
|
||||
class="w-1/2 text-3xl bg-red-500 border border-white"
|
||||
disabled
|
||||
class:opacity-30={answer.answer !== selected_answer}>{answer.answer}</button
|
||||
>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<script lang="ts">
|
||||
import type { Answer, QuizData } from '../../app';
|
||||
|
||||
export let results: Array<Answer>;
|
||||
export let game_data: QuizData;
|
||||
export let question_index: number;
|
||||
let data_store = {};
|
||||
|
||||
const question = game_data.questions[question_index].answers;
|
||||
for (let i = 0; i < question.length; i++) {
|
||||
console.log(question[i].answer, 'HI!!!');
|
||||
data_store[question[i].answer] = 0;
|
||||
}
|
||||
console.log(data_store);
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
console.log(results[i].answer);
|
||||
data_store[results[i].answer] += 1;
|
||||
}
|
||||
|
||||
console.log(data_store);
|
||||
</script>
|
||||
|
||||
<!-- Show the results from the results object -->
|
||||
<!-- Language: SvelteHTML -->
|
||||
<!-- Path: frontend/src/lib/play/show_results.svelte -->
|
||||
|
||||
<div>
|
||||
<h2>Results</h2>
|
||||
<div class="flex flex-col">
|
||||
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||
<div class="inline-block py-2 min-w-full sm:px-6 lg:px-8">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
<table class="min-w-full">
|
||||
<thead class="bg-gray-50 dark:bg-gray-700">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
|
||||
>
|
||||
Answer
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
|
||||
>
|
||||
Count
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
|
||||
>
|
||||
Right
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- Product 1 -->
|
||||
{#each game_data.questions[question_index].answers as answer}
|
||||
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
|
||||
<td
|
||||
class="py-4 px-6 text-sm font-medium text-gray-900 whitespace-nowrap dark:text-white"
|
||||
>
|
||||
{answer.answer}
|
||||
</td>
|
||||
<td
|
||||
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
|
||||
>
|
||||
{data_store[answer.answer]}
|
||||
</td>
|
||||
<td
|
||||
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
|
||||
>
|
||||
{#if answer.right}
|
||||
✅
|
||||
{:else}
|
||||
❌
|
||||
{/if}
|
||||
</td>
|
||||
</tr>{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3,8 +3,7 @@
|
||||
export let description: string;
|
||||
</script>
|
||||
|
||||
|
||||
<div class='flex flex-col justify-center w-screen h-screen'>
|
||||
<h1 class='text-7xl text-center'>{title}</h1>
|
||||
<p class='text-3xl pt-8 text-center'>{description}</p>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center w-screen h-screen">
|
||||
<h1 class="text-7xl text-center">{title}</h1>
|
||||
<p class="text-3xl pt-8 text-center">{description}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { io } from 'socket.io-client';
|
||||
|
||||
export const socket = io();
|
||||
export const socket = io();
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
<script>import "../app.css";</script><slot></slot>
|
||||
<script>
|
||||
import '../app.css';
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
<script context='module' lang='ts'>
|
||||
export async function load({ session, request }) {
|
||||
<script context="module" lang="ts">
|
||||
export async function load({ session }) {
|
||||
if (session.authenticated) {
|
||||
return {
|
||||
status: 302,
|
||||
redirect: "/"
|
||||
redirect: '/'
|
||||
};
|
||||
}
|
||||
return {}
|
||||
return {};
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
//import { rememberme } from '$lib/utils/clientAuth';
|
||||
import { browser } from '$app/env';
|
||||
|
||||
/*if (browser) {
|
||||
rememberme().then((res) => {
|
||||
@@ -22,7 +21,6 @@
|
||||
});
|
||||
}*/
|
||||
|
||||
|
||||
let loginData = {
|
||||
email: '',
|
||||
password: ''
|
||||
@@ -64,110 +62,108 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class='flex items-center justify-center h-screen px-4'>
|
||||
<div class="flex items-center justify-center h-screen px-4">
|
||||
<div>
|
||||
|
||||
<span class='p-4' />
|
||||
<span class="p-4" />
|
||||
|
||||
<div
|
||||
class='w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800'
|
||||
class="w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800"
|
||||
>
|
||||
<div class='px-6 py-4'>
|
||||
<h2 class='text-3xl font-bold text-center text-gray-700 dark:text-white'>ClassQuiz</h2>
|
||||
<div class="px-6 py-4">
|
||||
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white">
|
||||
ClassQuiz
|
||||
</h2>
|
||||
|
||||
<h3 class='mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200'>
|
||||
<h3 class="mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200">
|
||||
Welcome Back
|
||||
</h3>
|
||||
|
||||
<p class='mt-1 text-center text-gray-500 dark:text-gray-400'>
|
||||
<p class="mt-1 text-center text-gray-500 dark:text-gray-400">
|
||||
Login or create account
|
||||
</p>
|
||||
|
||||
<form on:submit|preventDefault={login}>
|
||||
<div class='w-full mt-4'>
|
||||
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
|
||||
<div class='relative bg-inherit w-full'>
|
||||
<div class="w-full mt-4">
|
||||
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
|
||||
<div class="relative bg-inherit w-full">
|
||||
<input
|
||||
id='email'
|
||||
id="email"
|
||||
bind:value={loginData.email}
|
||||
name='email'
|
||||
type='email'
|
||||
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
|
||||
placeholder='Email'
|
||||
name="email"
|
||||
type="email"
|
||||
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
|
||||
placeholder="Email"
|
||||
/>
|
||||
<label
|
||||
for='email'
|
||||
class='absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
|
||||
for="email"
|
||||
class="absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
|
||||
>
|
||||
Email
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
|
||||
<div
|
||||
class='relative bg-inherit w-full'
|
||||
|
||||
>
|
||||
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
|
||||
<div class="relative bg-inherit w-full">
|
||||
<input
|
||||
id='password'
|
||||
name='password'
|
||||
type='password'
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
bind:value={loginData.password}
|
||||
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
|
||||
placeholder='Password'
|
||||
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<label
|
||||
for='password'
|
||||
class='absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
|
||||
for="password"
|
||||
class="absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
|
||||
>
|
||||
Password
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='flex items-center justify-between mt-4'>
|
||||
<div class="flex items-center justify-between mt-4">
|
||||
<a
|
||||
href='/account/reset-password'
|
||||
class='text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500'
|
||||
>Forgot Password?</a
|
||||
href="/account/reset-password"
|
||||
class="text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500"
|
||||
>Forgot Password?</a
|
||||
>
|
||||
|
||||
<button
|
||||
class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50'
|
||||
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
|
||||
disabled={!inputValid}
|
||||
type='submit'>
|
||||
type="submit"
|
||||
>
|
||||
{#if isSubmitting}
|
||||
<svg class='h-4 w-4 animate-spin' viewBox='3 3 18 18'>
|
||||
<svg class="h-4 w-4 animate-spin" viewBox="3 3 18 18">
|
||||
<path
|
||||
class='fill-blue-800'
|
||||
d='M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z'
|
||||
class="fill-blue-800"
|
||||
d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
|
||||
/>
|
||||
<path
|
||||
class='fill-blue-100'
|
||||
d='M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z'
|
||||
class="fill-blue-100"
|
||||
d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z"
|
||||
/>
|
||||
</svg>
|
||||
{:else}
|
||||
Login
|
||||
{/if}
|
||||
</button
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class='flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700'
|
||||
class="flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700"
|
||||
>
|
||||
<span class='text-sm text-gray-600 dark:text-gray-200'
|
||||
>Don't have an account?
|
||||
<span class="text-sm text-gray-600 dark:text-gray-200"
|
||||
>Don't have an account?
|
||||
</span>
|
||||
|
||||
<a
|
||||
href='/account/register'
|
||||
class='mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline'
|
||||
>Register</a
|
||||
href="/account/register"
|
||||
class="mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline"
|
||||
>Register</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -175,14 +171,14 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
class='fixed z-10 inset-0 overflow-y-auto'
|
||||
aria-labelledby='modal-title'
|
||||
role='dialog'
|
||||
aria-modal='true'
|
||||
class="fixed z-10 inset-0 overflow-y-auto"
|
||||
aria-labelledby="modal-title"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
class:hidden={!responseData.open}
|
||||
>
|
||||
<div
|
||||
class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
|
||||
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
|
||||
>
|
||||
<!--
|
||||
Background overlay, show/hide based on modal state.
|
||||
@@ -195,13 +191,13 @@
|
||||
To: "opacity-0"
|
||||
-->
|
||||
<div
|
||||
class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
|
||||
aria-hidden='true'
|
||||
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
<!-- This element is to trick the browser into centering the modal contents. -->
|
||||
<span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
|
||||
>​</span
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true"
|
||||
>​</span
|
||||
>
|
||||
|
||||
<!--
|
||||
@@ -215,50 +211,49 @@
|
||||
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
-->
|
||||
<div
|
||||
class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
|
||||
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
||||
>
|
||||
<div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
|
||||
<div class='sm:flex sm:items-start'>
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div
|
||||
class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
|
||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||
>
|
||||
<!-- Heroicon name: outline/exclamation -->
|
||||
{#if responseData.data === '404' || responseData.data === 'error'}
|
||||
<svg
|
||||
class='h-6 w-6 text-red-600'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
fill='none'
|
||||
viewBox='0 0 24 24'
|
||||
stroke='currentColor'
|
||||
aria-hidden='true'
|
||||
class="h-6 w-6 text-red-600"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
stroke-linecap='round'
|
||||
stroke-linejoin='round'
|
||||
stroke-width='2'
|
||||
d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
||||
/>
|
||||
</svg>
|
||||
{:else}
|
||||
<svg
|
||||
class='w-6 h-6 text-green-600'
|
||||
fill='none'
|
||||
stroke='currentColor'
|
||||
viewBox='0 0 24 24'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
class="w-6 h-6 text-green-600"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
stroke-linecap='round'
|
||||
stroke-linejoin='round'
|
||||
stroke-width='2'
|
||||
d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg
|
||||
>
|
||||
</svg>
|
||||
{/if}
|
||||
</div>
|
||||
<div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
|
||||
<h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
|
||||
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
|
||||
{#if responseData.data === 'magic'}
|
||||
Login Succeded! Check your mailbox!
|
||||
{:else if responseData.data === 'password'}
|
||||
@@ -271,8 +266,8 @@
|
||||
You stupid Mawoka!
|
||||
{/if}
|
||||
</h3>
|
||||
<div class='mt-2'>
|
||||
<p class='text-sm text-gray-500'>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-gray-500">
|
||||
{#if responseData.data === 'magic'}
|
||||
Please check your mailbox, since you should have received a
|
||||
Mail, with a link you can click to login.
|
||||
@@ -290,19 +285,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
|
||||
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
||||
<button
|
||||
type='button'
|
||||
type="button"
|
||||
on:click={() => {
|
||||
responseData.open = false;
|
||||
if (responseData.data === 'magic' || responseData.data === 'password') {
|
||||
window.location.reload();
|
||||
}
|
||||
}}
|
||||
class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
|
||||
>Close
|
||||
</button
|
||||
>
|
||||
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
||||
>Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script context='module' lang='ts'>
|
||||
<script context="module" lang="ts">
|
||||
export async function load({ session }) {
|
||||
if (session.authenticated) {
|
||||
return {
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
import { createForm } from 'felte';
|
||||
// import reporter from '@felte/reporter-tippy';
|
||||
import { validateSchema } from '@felte/validator-yup';
|
||||
@@ -22,14 +22,20 @@
|
||||
password2: yup
|
||||
.string()
|
||||
.required()
|
||||
.test('equal', 'Passwords do not match!', function(v) {
|
||||
.test('equal', 'Passwords do not match!', function (v) {
|
||||
const ref = yup.ref('password1');
|
||||
return v === this.resolve(ref);
|
||||
}),
|
||||
username: yup.string().required().min(3, 'must be at least 3 characters long').max(20, 'must be at most 20 characters long')
|
||||
username: yup
|
||||
.string()
|
||||
.required()
|
||||
.min(3, 'must be at least 3 characters long')
|
||||
.max(20, 'must be at most 20 characters long')
|
||||
});
|
||||
|
||||
const { form, errors, touched, isValid, isSubmitting } = createForm<yup.InferType<typeof registerSchema>>({
|
||||
const { form, errors, touched, isValid, isSubmitting } = createForm<
|
||||
yup.InferType<typeof registerSchema>
|
||||
>({
|
||||
validate: validateSchema(registerSchema),
|
||||
onSubmit: async (values) => {
|
||||
const res = await fetch('/api/v1/users/create', {
|
||||
@@ -61,126 +67,126 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class='flex items-center justify-center h-screen px-4'>
|
||||
<div class="flex items-center justify-center h-screen px-4">
|
||||
<div>
|
||||
<div
|
||||
class='w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800'
|
||||
class="w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800"
|
||||
>
|
||||
<div class='px-6 py-4'>
|
||||
<h2 class='text-3xl font-bold text-center text-gray-700 dark:text-white'>ImNote</h2>
|
||||
<div class="px-6 py-4">
|
||||
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white">ImNote</h2>
|
||||
|
||||
<h3 class='mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200'>
|
||||
<h3 class="mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200">
|
||||
Nice to meet you!
|
||||
</h3>
|
||||
|
||||
<p class='mt-1 text-center text-gray-500 dark:text-gray-400'>Create account</p>
|
||||
<p class="mt-1 text-center text-gray-500 dark:text-gray-400">Create account</p>
|
||||
|
||||
<form use:form>
|
||||
<div class='w-full mt-4'>
|
||||
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
|
||||
<div class='relative bg-inherit w-full'>
|
||||
<div class="w-full mt-4">
|
||||
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
|
||||
<div class="relative bg-inherit w-full">
|
||||
<input
|
||||
id='email'
|
||||
name='email'
|
||||
type='email'
|
||||
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
|
||||
placeholder='Email'
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
|
||||
placeholder="Email"
|
||||
class:ring-red-700={$errors.email !== null}
|
||||
class:ring-green-600={$touched.email === true &&
|
||||
$errors.email === null}
|
||||
/>
|
||||
<label
|
||||
for='email'
|
||||
class='absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
|
||||
for="email"
|
||||
class="absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
|
||||
>
|
||||
Email
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
|
||||
<div class='relative bg-inherit w-full'>
|
||||
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
|
||||
<div class="relative bg-inherit w-full">
|
||||
<input
|
||||
id='username'
|
||||
name='username'
|
||||
type='text'
|
||||
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
|
||||
placeholder='Username'
|
||||
id="username"
|
||||
name="username"
|
||||
type="text"
|
||||
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
|
||||
placeholder="Username"
|
||||
class:ring-red-700={$errors.username !== null}
|
||||
class:ring-green-600={$touched.username === true &&
|
||||
$errors.username === null}
|
||||
/>
|
||||
<label
|
||||
for='username'
|
||||
class='absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
|
||||
for="username"
|
||||
class="absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
|
||||
>
|
||||
Username
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
|
||||
<div class='relative bg-inherit w-full'>
|
||||
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
|
||||
<div class="relative bg-inherit w-full">
|
||||
<input
|
||||
id='password1'
|
||||
name='password1'
|
||||
type='password'
|
||||
id="password1"
|
||||
name="password1"
|
||||
type="password"
|
||||
class:ring-red-700={$errors.password1 !== null}
|
||||
class:ring-green-600={$touched.password1 === true &&
|
||||
$errors.password1 === null}
|
||||
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
|
||||
placeholder='Password'
|
||||
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<label
|
||||
for='password1'
|
||||
class='absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
|
||||
for="password1"
|
||||
class="absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
|
||||
>
|
||||
Password
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
|
||||
<div class='relative bg-inherit w-full'>
|
||||
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
|
||||
<div class="relative bg-inherit w-full">
|
||||
<input
|
||||
id='password2'
|
||||
name='password2'
|
||||
type='password'
|
||||
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
|
||||
placeholder='Password'
|
||||
id="password2"
|
||||
name="password2"
|
||||
type="password"
|
||||
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
|
||||
placeholder="Password"
|
||||
class:ring-red-700={$errors.password2 !== null}
|
||||
class:ring-green-600={$touched.password2 === true &&
|
||||
$errors.password2 === null}
|
||||
/>
|
||||
<label
|
||||
for='password2'
|
||||
class='absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
|
||||
for="password2"
|
||||
class="absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
|
||||
>
|
||||
Password
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='flex items-center justify-between mt-4'>
|
||||
<div class="flex items-center justify-between mt-4">
|
||||
<a
|
||||
href='/account/reset-password'
|
||||
class='text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500'
|
||||
>Forgot Password?</a
|
||||
href="/account/reset-password"
|
||||
class="text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500"
|
||||
>Forgot Password?</a
|
||||
>
|
||||
|
||||
<button
|
||||
class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none'
|
||||
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none"
|
||||
disabled={!$isValid || $isSubmitting}
|
||||
class:cursor-not-allowed={!$isValid || $isSubmitting}
|
||||
class:opacity-50={!$isValid || $isSubmitting}
|
||||
type='submit'
|
||||
type="submit"
|
||||
>
|
||||
{#if $isSubmitting}
|
||||
<svg class='h-4 w-4 animate-spin' viewBox='3 3 18 18'>
|
||||
<svg class="h-4 w-4 animate-spin" viewBox="3 3 18 18">
|
||||
<path
|
||||
class='fill-blue-800'
|
||||
d='M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z'
|
||||
class="fill-blue-800"
|
||||
d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
|
||||
/>
|
||||
<path
|
||||
class='fill-blue-100'
|
||||
d='M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z'
|
||||
class="fill-blue-100"
|
||||
d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z"
|
||||
/>
|
||||
</svg>
|
||||
{:else}
|
||||
@@ -193,16 +199,16 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
class='flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700'
|
||||
class="flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700"
|
||||
>
|
||||
<span class='text-sm text-gray-600 dark:text-gray-200'
|
||||
>Already have an account?
|
||||
<span class="text-sm text-gray-600 dark:text-gray-200"
|
||||
>Already have an account?
|
||||
</span>
|
||||
|
||||
<a
|
||||
href='/account/login'
|
||||
class='mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline'
|
||||
>Login</a
|
||||
href="/account/login"
|
||||
class="mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline"
|
||||
>Login</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -210,14 +216,14 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
class='fixed z-10 inset-0 overflow-y-auto'
|
||||
aria-labelledby='modal-title'
|
||||
role='dialog'
|
||||
aria-modal='true'
|
||||
class="fixed z-10 inset-0 overflow-y-auto"
|
||||
aria-labelledby="modal-title"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
class:hidden={!responseData.open}
|
||||
>
|
||||
<div
|
||||
class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
|
||||
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
|
||||
>
|
||||
<!--
|
||||
Background overlay, show/hide based on modal state.
|
||||
@@ -230,13 +236,13 @@
|
||||
To: "opacity-0"
|
||||
-->
|
||||
<div
|
||||
class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
|
||||
aria-hidden='true'
|
||||
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
<!-- This element is to trick the browser into centering the modal contents. -->
|
||||
<span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
|
||||
>​</span
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true"
|
||||
>​</span
|
||||
>
|
||||
|
||||
<!--
|
||||
@@ -250,50 +256,49 @@
|
||||
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
-->
|
||||
<div
|
||||
class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
|
||||
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
||||
>
|
||||
<div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
|
||||
<div class='sm:flex sm:items-start'>
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div
|
||||
class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
|
||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||
>
|
||||
<!-- Heroicon name: outline/exclamation -->
|
||||
{#if responseData.data === '409' || responseData.data === 'error' || responseData.data === '400'}
|
||||
<svg
|
||||
class='h-6 w-6 text-red-600'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
fill='none'
|
||||
viewBox='0 0 24 24'
|
||||
stroke='currentColor'
|
||||
aria-hidden='true'
|
||||
class="h-6 w-6 text-red-600"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
stroke-linecap='round'
|
||||
stroke-linejoin='round'
|
||||
stroke-width='2'
|
||||
d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
||||
/>
|
||||
</svg>
|
||||
{:else}
|
||||
<svg
|
||||
class='w-6 h-6 text-green-600'
|
||||
fill='none'
|
||||
stroke='currentColor'
|
||||
viewBox='0 0 24 24'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
class="w-6 h-6 text-green-600"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
stroke-linecap='round'
|
||||
stroke-linejoin='round'
|
||||
stroke-width='2'
|
||||
d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg
|
||||
>
|
||||
</svg>
|
||||
{/if}
|
||||
</div>
|
||||
<div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
|
||||
<h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
|
||||
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
|
||||
{#if responseData.data === '409'}
|
||||
Account already exists!
|
||||
{:else if responseData.data === 'error'}
|
||||
@@ -306,8 +311,8 @@
|
||||
You stupid Mawoka!
|
||||
{/if}
|
||||
</h3>
|
||||
<div class='mt-2'>
|
||||
<p class='text-sm text-gray-500'>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-gray-500">
|
||||
{#if responseData.data === '200'}
|
||||
You signed up successfully! Please check your mailbox to confirm
|
||||
your email address!
|
||||
@@ -325,16 +330,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
|
||||
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
||||
<button
|
||||
type='button'
|
||||
type="button"
|
||||
on:click={() => {
|
||||
responseData.open = false;
|
||||
}}
|
||||
class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
|
||||
>Close
|
||||
</button
|
||||
>
|
||||
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
||||
>Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
import type { QuizData } from '../app';
|
||||
|
||||
import { socket } from '$lib/socket';
|
||||
|
||||
let gameData = {
|
||||
game_id: '4ced1410-e2bf-47e6-9bc7-c1f332642963',
|
||||
game_pin: '81039240'
|
||||
game_id: 'a7ddb6af-79ab-45e0-b996-6254c1ad9818',
|
||||
game_pin: '66190765'
|
||||
};
|
||||
let success = false;
|
||||
let players: Array<string> = [];
|
||||
@@ -49,7 +49,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
socket.on('question_results', (data) => {
|
||||
data = JSON.parse(data);
|
||||
console.log(data);
|
||||
@@ -69,51 +68,56 @@
|
||||
timer_res = seconds.toString();
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{#if !success}
|
||||
<input placeholder='game id' bind:value={gameData.game_id}>
|
||||
<input placeholder='game pin' bind:value={gameData.game_pin}>
|
||||
<input placeholder="game id" bind:value={gameData.game_id} />
|
||||
<input placeholder="game pin" bind:value={gameData.game_pin} />
|
||||
<button on:click={connect}>Connect!</button>
|
||||
{#if errorMessage !== ""}
|
||||
<p class='text-red-700'>{errorMessage}</p>
|
||||
{#if errorMessage !== ''}
|
||||
<p class="text-red-700">{errorMessage}</p>
|
||||
{/if}
|
||||
{:else }
|
||||
{#if !game_started}
|
||||
<ul>
|
||||
{#if players.length > 0}
|
||||
{#each players as player}
|
||||
<li><span>{player.username} </span>
|
||||
<button>Kick</button>
|
||||
</li>
|
||||
{/each}
|
||||
{/if}
|
||||
</ul>
|
||||
{:else if !game_started}
|
||||
<ul>
|
||||
{#if players.length > 0}
|
||||
<button on:click={() => {socket.emit('start_game', ""); game_started = true}}>Start Game</button>
|
||||
{#each players as player}
|
||||
<li>
|
||||
<span>{player.username} </span>
|
||||
<button>Kick</button>
|
||||
</li>
|
||||
{/each}
|
||||
{/if}
|
||||
{:else }
|
||||
<span>Time left: {timer_res}</span>
|
||||
<br>
|
||||
{#if timer_res === '0'}
|
||||
<button on:click={get_question_results}>Get results</button>
|
||||
<br>
|
||||
{#if question_results !== null}
|
||||
{question_results}
|
||||
<br>
|
||||
<ul>
|
||||
{#each question_results as result}
|
||||
<li>{result.username} - {result.answer} - {result.right}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{/if}
|
||||
<br>
|
||||
{#each quiz_data.questions as { question }, index}
|
||||
<button on:click={() => {set_question_number(index)}}>{index}: {question}</button>
|
||||
<br>
|
||||
{/each}
|
||||
</ul>
|
||||
{#if players.length > 0}
|
||||
<button
|
||||
on:click={() => {
|
||||
socket.emit('start_game', '');
|
||||
game_started = true;
|
||||
}}>Start Game</button
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
{:else}
|
||||
<span>Time left: {timer_res}</span>
|
||||
<br />
|
||||
{#if timer_res === '0'}
|
||||
<button on:click={get_question_results}>Get results</button>
|
||||
<br />
|
||||
{#if question_results !== null}
|
||||
<br />
|
||||
<ul>
|
||||
{#each question_results as result}
|
||||
<li>{result.username} - {result.answer} - {result.right}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{/if}
|
||||
<br />
|
||||
{#each quiz_data.questions as { question }, index}
|
||||
<button
|
||||
on:click={() => {
|
||||
set_question_number(index);
|
||||
}}>{index}: {question}</button
|
||||
>
|
||||
<br />
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
import type { QuizData } from '../app';
|
||||
import Title from '$lib/play/title.svelte';
|
||||
import Question from '$lib/play/question.svelte';
|
||||
import {socket} from '$lib/socket';
|
||||
import { socket } from '$lib/socket';
|
||||
|
||||
interface GameMeta {
|
||||
started: boolean;
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
let question_index = '';
|
||||
|
||||
|
||||
let unique = {};
|
||||
|
||||
function restart() {
|
||||
@@ -53,30 +52,24 @@
|
||||
socket.on('start_game', (data) => {
|
||||
gameMeta.started = true;
|
||||
});
|
||||
|
||||
socket.on('set_question_number', (data) => {
|
||||
restart();
|
||||
question_index = data;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{#if !gameMeta.started}
|
||||
<input bind:value={gameId} placeholder='GameID'>
|
||||
<input bind:value={username} placeholder='Username'>
|
||||
<input bind:value={gameId} placeholder="GameID" />
|
||||
<input bind:value={username} placeholder="Username" />
|
||||
|
||||
<button on:click={connect}>Connect</button>
|
||||
|
||||
<br>
|
||||
<input bind:value={message} placeholder='message'>
|
||||
<br />
|
||||
<input bind:value={message} placeholder="message" />
|
||||
<button on:click={sendMessage}>Send Message</button>
|
||||
|
||||
{:else if question_index === ''}
|
||||
<Title bind:description={gameData.description} bind:title={gameData.title} />
|
||||
{:else}
|
||||
{#if question_index === ""}
|
||||
<Title bind:description={gameData.description} bind:title={gameData.title} />
|
||||
{:else}
|
||||
{#key unique}
|
||||
<Question bind:question={gameData.questions[parseInt(question_index)]} bind:question_index/>
|
||||
{/key}
|
||||
{/if}
|
||||
{/if}
|
||||
{#key unique}
|
||||
<Question
|
||||
bind:question={gameData.questions[parseInt(question_index)]}
|
||||
bind:question_index
|
||||
/>
|
||||
{/key}
|
||||
{/if}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script context='module' lang='ts'>
|
||||
<script context="module" lang="ts">
|
||||
export async function load({ session }) {
|
||||
if (!session.authenticated) {
|
||||
return {
|
||||
@@ -12,4 +12,4 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script context='module' lang='ts'>
|
||||
<script context="module" lang="ts">
|
||||
export async function load({ url }) {
|
||||
const token = url.searchParams.get('token');
|
||||
return {
|
||||
@@ -9,48 +9,84 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
import { socket } from '$lib/socket';
|
||||
|
||||
import JoinGame from '$lib/play/join.svelte';
|
||||
import type { Answer, QuizData } from '../app';
|
||||
import ShowTitle from '$lib/play/title.svelte';
|
||||
import Question from '$lib/play/question.svelte';
|
||||
import ShowResults from '$lib/play/show_results.svelte';
|
||||
// Exports
|
||||
export let game_pin: string;
|
||||
let game_pin_valid = false;
|
||||
console.log(game_pin);
|
||||
|
||||
// Types
|
||||
interface GameMeta {
|
||||
started: boolean;
|
||||
}
|
||||
|
||||
const setUsername = (username: string) => {
|
||||
console.log(username);
|
||||
};
|
||||
const setGamePin = (game_pin: string) => {
|
||||
socket.emit()
|
||||
// Variables init
|
||||
let question_index = '';
|
||||
let unique = {};
|
||||
let game_pin_valid: boolean;
|
||||
let answer_results: Array<Answer>;
|
||||
let gameData: QuizData;
|
||||
let gameMeta: GameMeta = {
|
||||
started: false
|
||||
};
|
||||
|
||||
$: console.log(game_pin.length);
|
||||
// Functions
|
||||
function restart() {
|
||||
unique = {};
|
||||
}
|
||||
|
||||
// Socket-events
|
||||
socket.on('joined_game', (data) => {
|
||||
console.log('joined_game', data);
|
||||
gameData = JSON.parse(data);
|
||||
});
|
||||
|
||||
socket.on('game_not_found', () => {
|
||||
game_pin_valid = false;
|
||||
});
|
||||
|
||||
socket.on('set_question_number', (data) => {
|
||||
restart();
|
||||
answer_results = undefined;
|
||||
question_index = data;
|
||||
});
|
||||
|
||||
socket.on('start_game', () => {
|
||||
gameMeta.started = true;
|
||||
});
|
||||
|
||||
socket.on('question_results', (data) => {
|
||||
restart();
|
||||
answer_results = JSON.parse(data);
|
||||
});
|
||||
// The rest
|
||||
|
||||
$: console.log(gameMeta.started, gameData !== undefined, question_index !== '');
|
||||
</script>
|
||||
|
||||
<div>
|
||||
{#if game_pin === "" || game_pin.length <= 7 || !game_pin_valid}
|
||||
<div class='flex flex-col justify-center align-center w-screen h-screen'>
|
||||
<form on:submit|preventDefault={setGamePin} class='flex-col flex justify-center align-center mx-auto'>
|
||||
<h1 class='text-lg text-center'>Game Pin</h1>
|
||||
<input class='border border-amber-800 self-center text-center' bind:value={game_pin} maxlength='8'>
|
||||
<br>
|
||||
<button class='bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded'
|
||||
type='submit'>
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div class='flex flex-col justify-center align-center w-screen h-screen'>
|
||||
<form on:submit|preventDefault={setUsername} class='flex-col flex justify-center align-center mx-auto'>
|
||||
<h1 class='text-lg text-center'>Username</h1>
|
||||
<input class='border border-amber-800'>
|
||||
<button class='bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded' type='submit'>
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{#if !gameMeta.started && gameData === undefined}
|
||||
<JoinGame {game_pin} />
|
||||
{:else if gameData !== undefined && question_index === ''}
|
||||
<ShowTitle bind:title={gameData.title} bind:description={gameData.description} />
|
||||
{:else if gameMeta.started && gameData !== undefined && question_index !== '' && answer_results === undefined}
|
||||
{#key unique}
|
||||
<Question
|
||||
bind:question={gameData.questions[parseInt(question_index)]}
|
||||
bind:question_index
|
||||
/>
|
||||
{/key}
|
||||
{:else if gameMeta.started && answer_results !== undefined}
|
||||
{#key unique}
|
||||
<ShowResults
|
||||
bind:results={answer_results}
|
||||
bind:game_data={gameData}
|
||||
bind:question_index
|
||||
/>
|
||||
{/key}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { io } from 'socket.io-client';
|
||||
|
||||
|
||||
const messageStore = writable('');
|
||||
|
||||
|
||||
// Connection opened
|
||||
|
||||
Reference in New Issue
Block a user