Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 72065c0d0d | |||
| cd8bb58dfb | |||
| 9ab1571067 |
@@ -7,7 +7,7 @@ from .routes_draft import draft_router
|
|||||||
from .print import print_router
|
from .print import print_router
|
||||||
|
|
||||||
from .models import Contract, ContractDraft, ContractDraftStatus, Party, replace_variables_in_value
|
from .models import Contract, ContractDraft, ContractDraftStatus, Party, replace_variables_in_value
|
||||||
from .schemas import ContractCreate, ContractRead, ContractUpdate, SignatureRead
|
from .schemas import ContractCreate, ContractRead, ContractUpdate
|
||||||
|
|
||||||
from ..entity.models import Entity
|
from ..entity.models import Entity
|
||||||
from ..template.models import ProvisionTemplate
|
from ..template.models import ProvisionTemplate
|
||||||
@@ -75,12 +75,10 @@ async def update(id: str, contract_form: ContractUpdate, user=Depends(get_curren
|
|||||||
|
|
||||||
|
|
||||||
@contract_router.get("/signature/{signature_id}", response_description="")
|
@contract_router.get("/signature/{signature_id}", response_description="")
|
||||||
async def get_signature(signature_id: str) -> SignatureRead:
|
async def get_signature(signature_id: str) -> Party:
|
||||||
contract = await Contract.find_by_signature_id(signature_id)
|
contract = await Contract.find_by_signature_id(signature_id)
|
||||||
signature = contract.get_signature(signature_id)
|
signature = contract.get_signature(signature_id)
|
||||||
signature_dict = signature.dict()
|
return signature
|
||||||
signature_dict['contract_label'] = contract.label
|
|
||||||
return signature_dict
|
|
||||||
|
|
||||||
|
|
||||||
@contract_router.post("/signature/{signature_id}", response_description="")
|
@contract_router.post("/signature/{signature_id}", response_description="")
|
||||||
|
|||||||
@@ -139,3 +139,18 @@ def retrieve_signature_png(filepath):
|
|||||||
base64_utf8_str = base64.b64encode(b_content).decode('utf-8')
|
base64_utf8_str = base64.b64encode(b_content).decode('utf-8')
|
||||||
ext = filepath.split('.')[-1]
|
ext = filepath.split('.')[-1]
|
||||||
return f'data:image/{ext};base64,{base64_utf8_str}'
|
return f'data:image/{ext};base64,{base64_utf8_str}'
|
||||||
|
|
||||||
|
|
||||||
|
@print_router.get("/opengraph/{signature_id}", response_class=HTMLResponse)
|
||||||
|
async def get_signature_opengraph(signature_id: str, request: Request) -> str:
|
||||||
|
contract = await Contract.find_by_signature_id(signature_id)
|
||||||
|
signature = contract.get_signature(signature_id)
|
||||||
|
template = templates.get_template("opengraph.html")
|
||||||
|
|
||||||
|
signatory = signature.representative.label if signature.representative else signature.entity.label
|
||||||
|
|
||||||
|
return template.render({
|
||||||
|
"signatory": signatory,
|
||||||
|
"title": contract.label,
|
||||||
|
"origin_url": f"{request.url.scheme}://{request.url.hostname}"
|
||||||
|
})
|
||||||
|
|||||||
10
back/app/contract/print/templates/opengraph.html
Normal file
10
back/app/contract/print/templates/opengraph.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta property="og:title" content="{{ title }}" />
|
||||||
|
<meta property="og:description" content="Cette page est à la destination exclusive de {{ signatory }}
|
||||||
|
Si vous n'êtes pas {{ signatory }}, veuillez fermer cette page immédiatement et surpprimer tous les liens en votre possession menant vers celle-ci.
|
||||||
|
En vous maintenant et/ou en interagissant avec cette page, vous enfreignez l'article L.229 du code pénal de l'Etat de San Andreas pour usurpation d'identité et vous vous exposez ainsi à une amende de 20 000$ ainsi qu'à des poursuites civiles.
|
||||||
|
Le cabinet Cooper, Hillman & Toshi LLC" />
|
||||||
|
<meta property="og:image" content="{{ origin_url }}/assets/logo.png" />
|
||||||
|
</head>
|
||||||
|
</html>
|
||||||
@@ -73,12 +73,3 @@ class ContractCreate(Writer):
|
|||||||
|
|
||||||
class ContractUpdate(BaseModel):
|
class ContractUpdate(BaseModel):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SignatureRead(BaseModel):
|
|
||||||
signature_uuid: str
|
|
||||||
entity: Entity
|
|
||||||
part: str
|
|
||||||
representative: Entity = None
|
|
||||||
signature_affixed: bool
|
|
||||||
contract_label: str
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, ElementRef, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, ParamMap } from "@angular/router";
|
import { ActivatedRoute, ParamMap } from "@angular/router";
|
||||||
import { DomSanitizer, Meta } from "@angular/platform-browser";
|
import { DomSanitizer } from "@angular/platform-browser";
|
||||||
import { ImageUploaderCrudService } from "@common/crud/crud.service";
|
import { ImageUploaderCrudService } from "@common/crud/crud.service";
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,12 @@ export class ContractsCardComponent extends BaseContractsComponent{
|
|||||||
<div class="row" *ngIf="!this.affixed">
|
<div class="row" *ngIf="!this.affixed">
|
||||||
<signature-drawer class="col-7"
|
<signature-drawer class="col-7"
|
||||||
(signatureDrawn$)="postSignature($event)"></signature-drawer>
|
(signatureDrawn$)="postSignature($event)"></signature-drawer>
|
||||||
<div class="col-5" i18n [innerHTML]="this.legalText"></div>
|
<div class="col-5" i18n>
|
||||||
|
<p>Cette page est à la destination exclusive de <strong>{{ this.signatory }}</strong></p>
|
||||||
|
<p>Si vous n'êtes <strong>pas</strong> {{ this.signatory }}, veuillez <strong>fermer cette page immédiatement</strong> et surpprimer tous les liens en votre possession menant vers celle-ci.</p>
|
||||||
|
<p>En vous maintenant et/ou en interagissant avec cette page, vous enfreignez l'article L.229 du code pénal de l'Etat de San Andreas pour <strong>usurpation d'identité</strong> et vous vous exposez ainsi à une amende de 20 000$ ainsi qu'à des poursuites civiles.</p>
|
||||||
|
<p>Le cabinet Cooper, Hillman & Toshi LLC</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-panel>
|
</ngb-panel>
|
||||||
@@ -112,13 +117,10 @@ export class ContractsSignatureComponent implements OnInit {
|
|||||||
|
|
||||||
affixed = false;
|
affixed = false;
|
||||||
|
|
||||||
public legalText: string = "";
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private crudService: ImageUploaderCrudService,
|
private crudService: ImageUploaderCrudService,
|
||||||
private meta: Meta,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -132,26 +134,8 @@ export class ContractsSignatureComponent implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
this.signatory = this.signature.entity.entity_data.firstname + " " + this.signature.entity.entity_data.lastname;
|
this.signatory = this.signature.entity.entity_data.firstname + " " + this.signature.entity.entity_data.lastname;
|
||||||
}
|
}
|
||||||
|
})
|
||||||
this.legalText = `
|
})
|
||||||
<p>Cette page est à la destination exclusive de <strong>${ this.signatory }</strong></p>
|
|
||||||
<p>Si vous n'êtes <strong>pas</strong> ${ this.signatory }, veuillez <strong>fermer cette page immédiatement</strong> et surpprimer tous les liens en votre possession menant vers celle-ci.</p>
|
|
||||||
<p>En vous maintenant et/ou en interagissant avec cette page, vous enfreignez l'article L.229 du code pénal de l'Etat de San Andreas pour <strong>usurpation d'identité</strong> et vous vous exposez ainsi à une amende de 20 000$ ainsi qu'à des poursuites civiles.</p>
|
|
||||||
<p>Le cabinet Cooper, Hillman & Toshi LLC</p>
|
|
||||||
`
|
|
||||||
|
|
||||||
this.meta.updateTag({
|
|
||||||
name: 'og:title',
|
|
||||||
property: 'og:title',
|
|
||||||
content: this.signature.contract_label});
|
|
||||||
this.meta.updateTag({
|
|
||||||
name: 'og:description',
|
|
||||||
property: 'og:description',
|
|
||||||
content: this.legalText.replace(/<[^>]*>/g, '').trim()
|
|
||||||
});
|
|
||||||
this.meta.updateTag({ name: 'og:image', content: `${location.origin}/assets/logo.png` });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreview() {
|
getPreview() {
|
||||||
|
|||||||
@@ -41,6 +41,25 @@ http {
|
|||||||
default_type text/javascript;
|
default_type text/javascript;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /contracts/signature/ {
|
||||||
|
set $is_robot 0;
|
||||||
|
if ($http_user_agent ~* "Discordbot|googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp") {
|
||||||
|
rewrite /contracts/signature/(.*) /api/v1/contract/print/opengraph/$1 last;
|
||||||
|
proxy_pass http://docker-back;
|
||||||
|
set $is_robot 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_robot = 0) {
|
||||||
|
rewrite ^ /index.html?$args last;
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
}
|
||||||
|
|
||||||
location /api/v1/ {
|
location /api/v1/ {
|
||||||
proxy_pass http://docker-back/;
|
proxy_pass http://docker-back/;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|||||||
@@ -26,6 +26,26 @@ http {
|
|||||||
proxy_set_header X-Forwarded-Host $server_name;
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /contracts/signature/ {
|
||||||
|
set $is_robot 0;
|
||||||
|
if ($http_user_agent ~* "Discordbot|googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp") {
|
||||||
|
rewrite /contracts/signature/(.*) /api/v1/contract/print/opengraph/$1 last;
|
||||||
|
proxy_pass http://docker-back;
|
||||||
|
break;
|
||||||
|
set $is_robot 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_robot = 0) {
|
||||||
|
proxy_pass http://docker-front;
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
}
|
||||||
|
|
||||||
location /api/v1/ {
|
location /api/v1/ {
|
||||||
proxy_pass http://docker-back/;
|
proxy_pass http://docker-back/;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|||||||
Reference in New Issue
Block a user