csrf remove

This commit is contained in:
Kseninia Mikhaylova 2024-07-23 09:42:13 +03:00
parent db671877b1
commit 9593ee02fa
9 changed files with 25 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
.idea/ .idea/
.vscode/ .vscode/
.venv/ .venv/
.env .env
env/*.env

View File

@ -37,11 +37,13 @@ ALLOWED_HOSTS = [
"toinv.svs-tech.pro", "toinv.svs-tech.pro",
] ]
CORS_ALLOWED_ORIGINS = [ CORS_ALLOWED_ORIGINS = [
"http://localhost",
"http://localhost:3000", "http://localhost:3000",
"http://192.168.103.159:3000", "http://192.168.103.159:3000",
"https://toinv.svs-tech.pro", "https://toinv.svs-tech.pro",
] ]
CSRF_TRUSTED_ORIGINS = [ CSRF_TRUSTED_ORIGINS = [
"http://localhost",
"https://toinv.svs-tech.pro", "https://toinv.svs-tech.pro",
] ]
# Application definition # Application definition

View File

@ -24,7 +24,9 @@ class TgItemViewSet(viewsets.ModelViewSet):
queryset = TgItem.objects.all().order_by("-updated_at") queryset = TgItem.objects.all().order_by("-updated_at")
serializer_class = TgItemSerializer serializer_class = TgItemSerializer
http_method_names = ["post", "get", "patch"] http_method_names = ["post", "get", "patch"]
permission_classes = ()
authentication_classes = ()
def retrieve(self, request, pk=None): def retrieve(self, request, pk=None):
item = TgItem.objects.get(id=pk) item = TgItem.objects.get(id=pk)
logger.info( logger.info(
@ -50,6 +52,8 @@ class TmcFieldViewset(viewsets.ModelViewSet):
queryset = TmcField.objects.all() queryset = TmcField.objects.all()
serializer_class = TmcFieldSerializer serializer_class = TmcFieldSerializer
http_method_names = ["post", "get", "patch"] http_method_names = ["post", "get", "patch"]
permission_classes = ()
authentication_classes = ()
def partial_update(self, request, *args, **kwargs): def partial_update(self, request, *args, **kwargs):
return super().partial_update(request) return super().partial_update(request)

View File

@ -13,7 +13,7 @@ services:
timeout: 3s timeout: 3s
retries: 20 retries: 20
volumes: volumes:
- ./.env:/app/.env - ./back/.env:/app/.env
networks: networks:
- toinv-network - toinv-network
image: ci.svs-tech.pro/toinv_back:latest image: ci.svs-tech.pro/toinv_back:latest

View File

@ -3,4 +3,7 @@ DB_USER=
DB_PASSWORD= DB_PASSWORD=
DB_HOST= DB_HOST=
DB_PORT= DB_PORT=
ODATA_AUTH= ODATA_AUTH=
TG_TOKEN=
NGROK_TEMP=

1
env/docker.env.example vendored Normal file
View File

@ -0,0 +1 @@
WEB_PORT=80

1
env/front.env.example vendored Normal file
View File

@ -0,0 +1 @@
NUXT_PUBLIC_API_BASE='http://localhost:8000/api'

View File

@ -43,10 +43,10 @@ onMounted(async () => {
loadTer() loadTer()
}) })
const patchField = async (field) => { const patchField = async (field) => {
await apiCall(`tgbot/items/${field.id}/`, 'PATCH', { text: field.text }) await apiCall(`tgbot/items/${field.id}/`, 'patch', { text: field.text })
} }
const patchItem = async () => { const patchItem = async () => {
await apiCall(`tgbot/${state.id}/`, 'PATCH', { name: state.name, location: state.location }) await apiCall(`tgbot/${state.id}/`, 'patch', { name: state.name, location: state.location })
} }
</script> </script>
<template> <template>

View File

@ -2,4 +2,10 @@
## DEV ## DEV
* Как запустить: `./dev.sh` * Как запустить: `./dev.sh`
## Примонтировать энв-файлы
* `ln -s ~/projects/to_inventory/env/docker.env ~/projects/to_inventory/.env`
* `ln -s ~/projects/to_inventory/env/back.env ~/projects/to_inventory/back/.env`
* `ln -s ~/projects/to_inventory/env/front.env ~/projects/to_inventory/front/.env`