Giter Club home page Giter Club logo

hanji-server's People

Contributors

dependabot[bot] avatar ninjaman494 avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aherzfeld deevee

hanji-server's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • Update GraphQL Dependencies (major) (@graphql-codegen/cli, @graphql-codegen/typescript, @graphql-codegen/typescript-resolvers, @types/graphql-upload, graphql-rate-limit-directive, graphql-upload)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/deploy.yml
  • actions/checkout v3
  • actions/setup-node v3
  • SpicyPizza/create-envfile v1
  • google-github-actions/auth v1
  • google-github-actions/deploy-appengine v1
.github/workflows/nodejs.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @apollo/server ^4.1.1
  • @google-cloud/debug-agent 7.2.2
  • @slack/web-api 6.8.1
  • async 3.2.4
  • body-parser ^1.20.1
  • cross-env ^7.0.3
  • dotenv 16.0.3
  • express 4.18.2
  • firebase-admin 11.7.0
  • glob 8.1.0
  • graphql ^16.6.0
  • graphql-rate-limit-directive ^1.3.0
  • graphql-tag ^2.12.6
  • graphql-upload ^13.0.0
  • lodash ^4.17.21
  • mongodb 4.16.0
  • node-cron 3.0.2
  • path 0.12.7
  • request 2.88.2
  • request-promise 4.2.6
  • tsconfig-paths ^4.1.0
  • @babel/core 7.21.4
  • @babel/preset-env 7.21.4
  • @babel/preset-typescript 7.21.4
  • @graphql-codegen/cli 2.16.5
  • @graphql-codegen/typescript 2.8.8
  • @graphql-codegen/typescript-resolvers 2.7.13
  • @shelf/jest-mongodb ^4.1.3
  • @types/express 4.17.17
  • @types/graphql-upload ^8.0.12
  • @types/jest ^29.1.1
  • @types/lodash ^4.14.184
  • @types/mongodb 4.0.6
  • @typescript-eslint/eslint-plugin 5.58.0
  • @typescript-eslint/parser 5.58.0
  • babel-jest ^29.1.2
  • babel-plugin-transform-es2015-modules-commonjs 6.26.2
  • casual 1.6.2
  • eslint 8.38.0
  • jest ^29.1.2
  • ts-node ^10.9.1
  • ts-node-dev 2.0.0
  • typescript 5.0.4

  • Check this box to trigger a request for Renovate to run again on this repository

Change app engine instance to a bigger size

According to the App Engine docs, we get 28 hours/day for free on "F" instances, regardless of size. Currently the server uses the smallest instance, F1. Since we're already hitting the RAM limit of F1 instances, we should upgrade to a larger size like F4 which will hopefully cut down on multiple instances being created.

Refactor code

Summary

A lot of the codebase contains giant files that should be broken down into smaller pieces of code (data sources, schema, resolvers, integration tests). Additionally, the Apollo integration testing code is using a deprecated package, so that should be updated as well.

Acceptance Criteria

  • Large files have been broken down into smaller chunks
  • Apollo tests are updated
  • New codebase structure allows for new features to be added without making the code bloated like it is now.

Search queries aren't trimmed of whitespace

Sentry report

The search endpoint doesn't trim queries before doing a search. In the report above, the user's search fails because they searched 만나다 instead of 마나다.

While this error happened on an old version of Hanji (3.0.1) and has since been fixed on the front-end, the server should still trim whitespace to handle older apps and other clients in the future.

In case the report expires, here's the GraphQL query that caused the error:

{
operationName: ConjugationsQuery, 
query: 
query ConjugationsQuery($stem: String!, $isAdj: Boolean!, $honorific: Boolean!, $regular: Boolean, $conjugations: [String]) {
  conjugations(
    stem: $stem
    isAdj: $isAdj
    honorific: $honorific
    regular: $regular
    conjugations: $conjugations
  ) {
    name
    conjugation
    type
    tense
    speechLevel
    honorific
    pronunciation
    romanization
    reasons
    __typename
  }
}
, 
variables: {"stem":"","isAdj":false,"regular":true,"honorific":false}
}

Change app-engine region

Since we've learned that a majority of our users are in Asia (Philippines esp), it doesn't really make sense to have the server in us-central. Instead we should move it to a different region that better caters to users located in Asia.

This won't be easy however, because an app's region cannot be changed once set. We'll have to create a new app-engine setup on a new GCP account, and then keep both instances up until everyone's migrated over. Additionally, the DB should also be moved to the same region, which greatly reduces the regions we can migrate to because a lot of them require a dedicated cluster.

이르다 dec. present low informal doesn't have any explanations

일러 has a short circuit in the conjugation code that's been there since the app's inception. The short circuit doesn't add any explanations, so the server returns an empty list for the conjugation. This is probably also affecting other conjugations for this adjective as well.

Update App Engine deploy step to v0

The last time I deployed I saw this warning:

Warning: google-github-actions/deploy-appengine is pinned at "main". We strongly advise against pinning to "@main" as it may be unstable

The warning recommended updating the line to this: uses: 'google-github-actions/deploy-appengine@v0'

계시다's regular forms are incorrect, and it shouldn't have honorific forms

One of the words in Hanji's dictionary is 계시다, which is for 있다's honorific form. This words regular declarative conjugations are incorrect, as correctly pointed in this bug report. Additionally, since it's honorific by default it shouldn't have separate honorific conjugations.

There are other words like 계시다 that are only used in honorific forms, like 들리다, so Hanji needs a good way to handle these. One solution could be to add an honorificOnly flag to database entries, so the app knows to disable the toggle and only show honorific conjugations for that word.

Duplicate Reasons

See 걷다, 듣다, and 춥다. 노랗다 and 낫다's 요 form is wrong too, but in a different way

Add Spell Check for Korean search

We have a search server to handle English, but if someone makes a typo in Korean ( which I do a lot :), Hanji won't show any results. A spell checker should be added to the back end to handle this.

Implement Apollo server security recommendations.

We should implement the following from apollo-server's release notes:

⚠️ SECURITY apollo-server-core: The default configuration of Apollo Server is vulnerable to denial of service attacks via memory exhaustion. If you do not currently specify the cache option to new ApolloServer(), we strongly recommend you specify cache: 'bounded', which replaces the default in-memory unbounded cache with a 30MB in-memory cache, or disable automatic persisted queries with persistedQueries: false. Apollo Server now logs a warning in production if you do not configure the cache or disable APQs. See the docs for more details

⚠️ SECURITY apollo-server-core: Apollo Server now includes protection against CSRF and XS-Search attacks. We highly recommend enabling this feature by passing csrfPrevention: true to new ApolloServer(). If you rely on the ability to execute GraphQL operations via HTTP GET requests using a client other than Apollo Client Web, Apollo iOS, or Apollo Kotlin (formerly Apollo Android), you may need to first change the configuration of that client. See the CSRF prevention docs for more details. This vulnerability was reported by Jeffrey Hofmann; the feature was designed with advice from Luca Carettoni of Doyensec.

Empty search query causes undefined exception

Sentry Report

If you use the Search endpoint with an empty query, the following error occurs:

Cannot read property 'hidden_padchim' of undefined

The search endpoint, and most likely other endpoints, should be updated to not allow empty strings. Likewise, the app will probably need to be updated to handle empty strings.

Clean up old code

The code in the korean folder is over ten years old and hasn't been touched since the conjugations were split up. It should be updated to current JavaScript standards and unused code should be deleted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.