dvalfrid / gastolibro Goto Github PK
View Code? Open in Web Editor NEWGuestbook
Guestbook
For admin functionalities.
Function for Logging in and Recieving a Token or some form of signature.
Function for Verifying signature.
INFO [2017-07-04 18|44| 17,431] org.eclipse.jetty.util.log: Logging initialized @881ms to org.eclipse.jetty.util.log.Slf4jLog
||
INFO [2017-07-04 18|44| 17,476] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /
||
INFO [2017-07-04 18|44| 17,477] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: /admin
||
INFO [2017-07-04 18|44| 17,478] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: home for path /*
||
INFO [2017-07-04 18|44| 17,566] io.dropwizard.server.SimpleServerFactory: Registering jersey handler with root path prefix: /
||
INFO [2017-07-04 18|44| 17,566] io.dropwizard.server.SimpleServerFactory: Registering admin handler with root path prefix: /admin
||
INFO [2017-07-04 18|44| 17,567] io.dropwizard.server.ServerFactory: Starting gastolibro
||
INFO [2017-07-04 18|44| 17,648] org.eclipse.jetty.setuid.SetUIDListener: Opened gastolibro@277b8fa4{HTTP/1.1,[http/1.1]}{0.0.0.0:3000}
||
INFO [2017-07-04 18|44| 17,650] org.eclipse.jetty.server.Server: jetty-9.4.z-SNAPSHOT
||
INFO [2017-07-04 18|44| 17,835] org.eclipse.jetty.server.AbstractConnector: Started gastolibro@277b8fa4{HTTP/1.1,[http/1.1]}{0.0.0.0:3000}
||
ERROR [2017-07-04 18|44| 17,837] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down
|| ! java.lang.IllegalStateException: Multiple servlets map to path /: home[mapped:JAVAX_API:null],io.dropwizard.jersey.setup.JerseyServletContainer-5f172d4a[mapped:EMBEDDED:null]
|| ! at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1414)
|| ! at org.eclipse.jetty.servlet.ServletHandler.doStart(ServletHandler.java:156)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
|| ! at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:830)
|| ! at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
|| ! at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
|| ! at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at com.codahale.metrics.jetty9.InstrumentedHandler.doStart(InstrumentedHandler.java:103)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:290)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at org.eclipse.jetty.server.handler.StatisticsHandler.doStart(StatisticsHandler.java:252)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
|| ! at org.eclipse.jetty.server.Server.start(Server.java:452)
|| ! at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
|| ! at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
|| ! at org.eclipse.jetty.server.Server.doStart(Server.java:419)
|| ! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
|| ! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
|| ! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
|| ! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
|| ! at io.dropwizard.cli.Cli.run(Cli.java:74)
|| ! at io.dropwizard.Application.run(Application.java:89)
|| ! at net.valfridsson.gastolibro.GastolibroApplication.main(GastolibroApplication.java:21)
||
INFO [2017-07-04 18|44| 17,846] org.eclipse.jetty.server.AbstractConnector: Stopped gastolibro@277b8fa4{HTTP/1.1,[http/1.1]}{0.0.0.0:3000}
||
INFO [2017-07-04 18|44| 17,846] org.eclipse.jetty.server.handler.ContextHandler: Stopped i.d.j.MutableServletContextHandler@4596f8f3{/,null,UNAVAILABLE}
||
|| Multiple servlets map to path /: home[mapped:JAVAX_API:null],io.dropwizard.jersey.setup.JerseyServletContainer-5f172d4a[mapped:EMBEDDED:null]
||
|| [Finished in 4 seconds with code 1]
The micro service should be able to handle assets
Get Source and Id for captcha.. verify Captcha answer and wether or not to present captcha.
Using Postgres or self-implemented Suffix Tree, whichever works!
https://www.postgresql.org/docs/8.3/static/fuzzystrmatch.html PSQL Fuzzy Search
Fuzzy Search Should return a JSON object with two fields
At the moment the db will be Queried every keypress, this might become a performance issue, if it does. We'll solve that problem when it arises! 🥇
Should support to blacklist IP adress
Suggestion:
GET /api/countries?term=SEARCHEDTERM -> JSON list of countries
GET /api/cities?country=COUNTRY&term=SEARCHEDTERM -> JSON list of cities
|| Tests run: 4, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.362 sec <<< FAILURE!
src/test/java/net/valfridsson/gastolibro/jdbi/EntryDaoTest.java|<findAll>|
|| java.lang.AssertionError:
|| Expecting:
|| <[net.valfridsson.gastolibro.core.Entry@2d480e69,
|| net.valfridsson.gastolibro.core.Entry@878fbb0,
|| net.valfridsson.gastolibro.core.Entry@392096f7,
|| net.valfridsson.gastolibro.core.Entry@b8b803e,
|| net.valfridsson.gastolibro.core.Entry@af0bfa79,
|| net.valfridsson.gastolibro.core.Entry@6cd25058]>
|| to contain only:
|| <[net.valfridsson.gastolibro.core.Entry@b8b803e,
|| net.valfridsson.gastolibro.core.Entry@392096f7,
|| net.valfridsson.gastolibro.core.Entry@878fbb0,
|| net.valfridsson.gastolibro.core.Entry@2d480e69]>
|| but the following elements were unexpected:
|| <[net.valfridsson.gastolibro.core.Entry@af0bfa79,
|| net.valfridsson.gastolibro.core.Entry@6cd25058]>
||
|| at net.valfridsson.gastolibro.jdbi.EntryDaoTest.findAll(EntryDaoTest.java:32)
|| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|| at java.lang.reflect.Method.invoke(Method.java:498)
|| at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
|| at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
|| at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
|| at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
|| at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
|| at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
|| at org.junit.rules.RunRules.evaluate(RunRules.java:20)
|| at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
|| at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
|| at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
|| at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
|| at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
|| at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
|| at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
|| at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
|| at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
|| at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
|| at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
|| at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
|| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|| at java.lang.reflect.Method.invoke(Method.java:498)
|| at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
|| at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
|| at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
|| at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
|| at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
||
src/test/java/net/valfridsson/gastolibro/jdbi/EntryDaoTest.java|<findX>|
|| java.lang.AssertionError:
|| Expecting:
|| <[net.valfridsson.gastolibro.core.Entry@7be8ba4d,
|| net.valfridsson.gastolibro.core.Entry@ff6ee0d4,
|| net.valfridsson.gastolibro.core.Entry@2559ca1b,
|| net.valfridsson.gastolibro.core.Entry@1d64562,
|| net.valfridsson.gastolibro.core.Entry@856c76e9,
|| net.valfridsson.gastolibro.core.Entry@5c729d70,
|| net.valfridsson.gastolibro.core.Entry@eab01cf7,
|| net.valfridsson.gastolibro.core.Entry@bd1b063e]>
|| to contain only:
|| <[net.valfridsson.gastolibro.core.Entry@7be8ba4d,
|| net.valfridsson.gastolibro.core.Entry@ff6ee0d4]>
|| but the following elements were unexpected:
|| <[net.valfridsson.gastolibro.core.Entry@2559ca1b,
|| net.valfridsson.gastolibro.core.Entry@1d64562,
|| net.valfridsson.gastolibro.core.Entry@856c76e9,
|| net.valfridsson.gastolibro.core.Entry@5c729d70,
|| net.valfridsson.gastolibro.core.Entry@eab01cf7,
|| net.valfridsson.gastolibro.core.Entry@bd1b063e]>
||
|| at net.valfridsson.gastolibro.jdbi.EntryDaoTest.findX(EntryDaoTest.java:48)
|| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|| at java.lang.reflect.Method.invoke(Method.java:498)
|| at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
|| at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
|| at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
|| at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
|| at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
|| at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
|| at org.junit.rules.RunRules.evaluate(RunRules.java:20)
|| at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
|| at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
|| at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
|| at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
|| at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
|| at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
|| at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
|| at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
|| at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
|| at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
|| at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
|| at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
|| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|| at java.lang.reflect.Method.invoke(Method.java:498)
|| at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
|| at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
|| at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
|| at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
|| at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
||
||
|| Results :
||
src/test/java/net/valfridsson/gastolibro/jdbi/EntryDaoTest.java|<findAll>| (..)
|| findX(net.valfridsson.gastolibro.jdbi.EntryDaoTest): (..)
||
|| Tests in error:
|| net.valfridsson.gastolibro.GastolibroApplicationTest: Multiple servlets map to path /*: home[mapped:JAVAX_API:null],io.dropwizard.jersey.setup.JerseyServletContainer-60e9c3a5[mapped:EMBEDDED:null]
||
|| Tests run: 7, Failures: 2, Errors: 1, Skipped: 0
||
Currently expect all countries to be in book with JSON key countries. Can change to separate call.
API for requesting cities in countries.
Request currently being sent to
/api/books/GenericBookId/search/?country=GenericCountry
should return a JSON list with country names.
API för Captchat.
Strukturer
Submit strukturen ser nu annorlunda ut
POST mot /api/entries (samma som förut, förväntar mig inget svar. Såvida inte vi vill lägga in en verifikation, finns ingen för tillfället.)
{
captcha: {
id: ETT_ID,
answer: ETT_SVAR
}
entry: {
title: EN_TITEL,
text: EN_TEXT,
time: TID,
name: NAMN,
email: EN_EMAIL,
country: ETT_LAND,
city: EN_STAD
}
}
NYA APIpunkter
GET /api/captcha (Kommer skicka dit 1gång varje gång någon öppnar fliken där man skriver in inlägg)
förväntar mig ett svar med följande struktur.
{
check: BOOL,
captcha: {
id: CAPTCHA_ID,
description: BESKRIVNING_AV_VAD_DE_SKA_GÖRA,
images: [LISTA_AV_FULLA_URL_LÄNKAR_TILL_BILDERNA] (ex, "captchas/captcha1/image1.jpg")
}
}
captcha kan vara null eller inte ens finnas där ifall BOOL = false
POST /api/captcha/check
Du får följande
{
answer: [LISTA_AV_FULLA_URL_LÄNKAR], (De som valts som svar)
id: CATCHA_ID
}
Förväntar mig endast en statuskod tillbaka
200 ifall det var rätt svar... något annat än 200 ifall det var fel svar.
Denna funktionen kommer kallas relativt ofta, varje gång de klickar på en bild, så se till att jämförelsefunktionen inte är allt för tung :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.