diff --git a/.gitea/workflows/basic.yaml b/.gitea/workflows/basic.yaml deleted file mode 100644 index 55276d3..0000000 --- a/.gitea/workflows/basic.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Basic Checking -run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: [push] - -jobs: - Explore-Gitea-Actions: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Check out repository code - uses: actions/checkout@v3 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18.x - - name: Install packages - run: npm install - - name: Run tests - run: npm test - - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/animals.json b/animals.json deleted file mode 100644 index 4d91903..0000000 --- a/animals.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "animals": [ - "Squirrel", - "Armadillo", - "Beaver", - "Cricket", - "Eagle", - "Ferret", - "Fox", - "Frog", - "Guinea Pig", - "Hamster", - "Hummingbird", - "Iguana", - "Mouse", - "Muskrat", - "Newt", - "Otter", - "Parakeet", - "Penguin", - "Pigeon", - "Possum", - "Rabbit", - "Raccoon", - "Rat", - "Snake", - "Spider", - "Turtle", - "Wolf pup", - "Squirrel", - "Possum", - "Frog", - "Rat", - "Otter", - "Raccoon", - "Snake", - "Ferret", - "Mouse", - "Armadillo", - "Hamster", - "Fox", - "Iguana", - "Spider", - "Turtle", - "Beaver", - "Rabbit", - "Eagle", - "Pigeon", - "Parakeet", - "Hummingbird", - "Penguin", - "Cricket", - "Newt", - "Muskrat", - "Guinea Pig", - "Quokka", - "Fennec Fox", - "Flying Squirrel", - "Hedgehog", - "Badger", - "Koala Bear", - "Porcupine", - "Skunk" - ] -} diff --git a/app.test.js b/app.test.js deleted file mode 100644 index 6450016..0000000 --- a/app.test.js +++ /dev/null @@ -1,29 +0,0 @@ -// app.test.js -const request = require('supertest'); -const app = require('./app'); - -describe('GET /', () => { - it('should respond with 200 status', async () => { - const response = await request(app).get('/'); - expect(response.statusCode).toBe(200); - //expect(response.body.message).toBe('Hello, World!'); - }); -}); - -describe('GET /asset/frontend.js', () => { - it('should respond with 200 status', async () => { - const response = await request(app).get('/asset/frontend.js'); - expect(response.statusCode).toBe(200); - //expect(response.body.message).toBe('Hello, World!'); - }); -}); - -describe('GET /getNextAnimal', () => { - it('should respond with 200 status', async () => { - const response = await request(app).get('/getNextAnimal'); - expect(response.statusCode).toBe(200); - //expect(response.body.message).toBe('Hello, World!'); - }); -}); - -// vim:set sts=2 sw=2 et: diff --git a/config.js b/config.js deleted file mode 100644 index 23f2f77..0000000 --- a/config.js +++ /dev/null @@ -1,17 +0,0 @@ -var config = module.exports; -var PRODUCTION = process.env.NODE_ENV === 'production'; -const bole = require('bole'); - -config.express = { - port: process.env.EXPRESS_PORT || 3000, - ip: '127.0.0.1', -}; - -if (PRODUCTION) { - config.express.ip = '0.0.0.0'; - config.db_path = "db/results.db"; - bole.output({ level: 'info', stream: process.stdout }) -} else { - config.db_path = ":memory:"; - bole.output({ level: 'debug', stream: process.stdout }) -} diff --git a/express/animals.json b/express/animals.json new file mode 100644 index 0000000..6981ee0 --- /dev/null +++ b/express/animals.json @@ -0,0 +1,31 @@ +{ + "animals": [ + "Squirrel", + "Armadillo", + "Beaver", + "Cricket", + "Eagle", + "Ferret", + "Fox", + "Frog", + "Guinea Pig", + "Hamster", + "Hummingbird", + "Iguana", + "Mouse", + "Muskrat", + "Newt", + "Otter", + "Parakeet", + "Penguin", + "Pigeon", + "Possum", + "Rabbit", + "Raccoon", + "Rat", + "Snake", + "Spider", + "Turtle", + "Wolf pup" + ] +} diff --git a/asset/frontend.js b/express/asset/frontend.js similarity index 100% rename from asset/frontend.js rename to express/asset/frontend.js diff --git a/express/asset/frontend.min.js b/express/asset/frontend.min.js new file mode 100644 index 0000000..daa3d12 --- /dev/null +++ b/express/asset/frontend.min.js @@ -0,0 +1 @@ +let a;let b;function c(){return (Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15))}async function d(){try {var A=await fetch('/getNextAnimal');var _=await A.json();document.getElementById('animal-name').textContent=_.animalName} catch (B) {console.error('Error fetching data:',B)}}function e(){var A=document.cookie.replace(/(?:(?:^|.*;\s*)sessionId\s*=\s*([^;]*).*$)|^.*$/,'$1');if(!A){var _=c();document.cookie=`sessionId=${_}`;return _}return A}function f(){var A=c();document.cookie=`sessionId=${A}`;g();e()}function g(){a=new Date()}function h(){if(a&&b){var A=b-a;console.log(`Time since session start: ${A} milliseconds`)}}document.getElementById('isCritterButton').addEventListener('click',()=>i('is critter',e()));document.getElementById('isNotCritterButton').addEventListener('click',()=>i('is not critter',e()));document.getElementById('startOverButton').addEventListener('click',()=>{f();d()});async function i(A,_){try {var B=new Date();if(b){var C=B-b,_b=document.getElementById('animal-name').textContent,_c=JSON.stringify({animal:_b,button:A,session:_,difference:C,time:a});await fetch('/recordButtonClick',{method:'POST',headers:{'Content-Type':'application/json'},body:_c})}b=B;h();d()} catch (_a) {console.error('Error recording button click:',_a)}}d();g(); diff --git a/db/.gitkeep b/express/db/.gitkeep similarity index 100% rename from db/.gitkeep rename to express/db/.gitkeep diff --git a/index.html b/express/index.html similarity index 88% rename from index.html rename to express/index.html index 61a89df..895eb64 100644 --- a/index.html +++ b/express/index.html @@ -6,7 +6,7 @@
-

Is this a Critter?

+

Is this a Critter?

what about?:

@@ -21,11 +21,8 @@ - +