Giter Club home page Giter Club logo

psychopass's People

Contributors

aliwoto avatar celestix avatar dank-del avatar the-blank-x avatar tsunayoshisawada avatar

Stargazers

 avatar

Watchers

 avatar

psychopass's Issues

[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe.

when debug variable in config file is set to true, gin prints these lines:

[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on :5101

the link is pointing to https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies, this issue needs more investigation.

Move types EndpointResponse and EndpointError to AnimeKaizoku/ssg package

Types EndpointResponse and EndpointError should be used as a generic types, and they should be defined in ssg package with this form:

type EndpointResponse[T any] struct {
	Success bool           `json:"success"`
	Result  *T             `json:"result"`
	Error   *EndpointError `json:"error"`
}

type EndpointError struct {
	ErrorCode int    `json:"code"`
	Message   string `json:"message"`
	Origin    string `json:"origin"`
	Date      string `json:"date"`
}

EndpointError needs to have a ErrorType field (integer) as well

If scan has already been closed, bot will edit the message with plain-text format

steps to reproduce:

1- close a multi-scan request
2- go to another chat and hit on "reject" button for the same multi-scan request.

what I expected:

bot should show the message "this scan has already been closed....", then edits the text of the message correctly.

what I saw:

image
(as you can see in screenshot), bot will edit the message in a plain-text format.

Add a mutex when trying to fetch db stats

this function needs a mutex.
Since multiple inspectors might send census command to fetch the stats, if there is no mutex in this function, database will be spammed with a large amount of sql queries... and this is what we don't want.

API shouldn't allow full-revert method for enforcers

Enforcers have +100 crime coefficient, but they are not banned, hence there is a possibility that someone might try full-revert method on them; resulting in clearing their crime coefficient. (they will still be treated as enforcer, but this time with less than 100 crime coefficients).

image


we have two choices:

  • make API prevent owners from using full-revert on Enforcers.
  • do nothing and announce it something intended that owners can use to clear out enforcer's crime coefficient.

strings.Title has been deprecated since Go 1.18

vscode is showing me this warning:
strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (SA1019)go-staticcheck

putting this issue here to find an alternative for strings.Title function (used in this line)

image

AssociationBanId field of the scans in multi-scan are not being set correctly

when someone sends association-ban request to api, we expect all of the scan values to have a valid AssociationBanId field set, but logs are saying otherwise:

2022/04/14 21:28:58 /home/ubuntu/aliwoto/projects/go/PsychoPass/sibyl/database/scans.go:49
INSERT INTO `reports` (`unique_id`,`reporter_id`,`target_user`,`target_type`,`report_date`,`report_reason`,`report_message`,`scan_source_link`,`agent_id`,`agent_reason`,`agent_date`,`reporter_permission`,`scan_status`,`association_ban_id`) VALUES ("6258921a-4fef6dbc-1f40",1341091260,8000,"0","14/04/2022 21:28:58","spamming NSFW stickers in groups","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f41",1341091260,8001,"0","14/04/2022 21:28:58","spamming NSFW stickers in groups","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f42",1341091260,8002,"0","14/04/2022 21:28:58","spamming NSFW stickers in groups","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f43",1341091260,8003,"0","14/04/2022 21:28:58","spamming NSFW stickers in groups","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f44",1341091260,8004,"0","14/04/2022 21:28:58","spamming NSFW stickers in groups","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f45",1341091260,8005,"0","14/04/2022 21:28:58","spamming NSFW stickers in groups","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f46",1341091260,8006,"0","14/04/2022 21:28:58","psychohazard","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f47",1341091260,8007,"0","14/04/2022 21:28:58","psychohazard","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f48",1341091260,8008,"0","14/04/2022 21:28:58","psychohazard","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0",""),("6258921a-4fef6dbc-1f49",1341091260,8009,"0","14/04/2022 21:28:58","psychohazard","message","https://t.me/c/1774295256/22990",0,"","0000-00-00 00:00:00","3","0","")

this will result in #6 (after restarting the api), since they are being cached in memory, but after restarting api, that cache will be lost.

prevent from overriding reason if the user is perma banned

Permanent ban means there is no way back for the user (unless they become unbanned directly by an inspector)
but currently, it's possible for those users to get banned by another reason and use auto-appeal system to unban themselves, api should be smart enough to prevent

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.