feat: sync preland pdf picker policy
deploy-preland / deploy barbariskatest (push) Successful in 19s

This commit is contained in:
Panfilov Konstantin committed 2026-10-14 21:03:46 +03:00
1 parent 98db1c2a16
commit 3eee288f78
1 file changed
+16 -1
+16 -1
View File
@@ -4,6 +4,7 @@ $errorMessage = Yii::t('app', 'Возникла ошибка');
$utmJson = json_encode($UTM ?? [], JSON_UNESCAPED_UNICODE); $utmJson = json_encode($UTM ?? [], JSON_UNESCAPED_UNICODE);
$createApiUrl = ($apiHost ?? '') . '/api/images/public/create'; $createApiUrl = ($apiHost ?? '') . '/api/images/public/create';
$uploadPolicyApiUrl = ($apiHost ?? '') . '/api/images/public/upload-policy';
$redirectUrlBase = $redirect_url_base ?? ''; $redirectUrlBase = $redirect_url_base ?? '';
$redirectUrlUtm = $redirect_url_utm ?? ''; $redirectUrlUtm = $redirect_url_utm ?? '';
@@ -42,7 +43,7 @@ $redirectUrlUtm = $redirect_url_utm ?? '';
</div> </div>
</div> </div>
<input type="file" id="dropzone-file-input" name="file" accept=".jpg,.jpeg,.png,.webp,.heic,.heif,.gif,.tif,.tiff,.bmp,.avif,.jxl,.dng,.pdf" style="display: none;"> <input type="file" id="dropzone-file-input" name="file" accept=".jpg,.jpeg,.png,.webp,.heic,.heif,.gif,.tif,.tiff,.bmp,.avif,.jxl,.dng" style="display: none;">
</form> </form>
<script> <script>
@@ -67,6 +68,7 @@ $redirectUrlUtm = $redirect_url_utm ?? '';
const redirectUrlBase = <?= json_encode($redirectUrlBase, JSON_UNESCAPED_UNICODE) ?>; const redirectUrlBase = <?= json_encode($redirectUrlBase, JSON_UNESCAPED_UNICODE) ?>;
const redirectUrlUtm = <?= json_encode($redirectUrlUtm, JSON_UNESCAPED_UNICODE) ?>; const redirectUrlUtm = <?= json_encode($redirectUrlUtm, JSON_UNESCAPED_UNICODE) ?>;
const createApiUrl = <?= json_encode($createApiUrl, JSON_UNESCAPED_UNICODE) ?>; const createApiUrl = <?= json_encode($createApiUrl, JSON_UNESCAPED_UNICODE) ?>;
const uploadPolicyApiUrl = <?= json_encode($uploadPolicyApiUrl, JSON_UNESCAPED_UNICODE) ?>;
const genericErrorMsg = <?= json_encode($errorMessage, JSON_UNESCAPED_UNICODE) ?>; const genericErrorMsg = <?= json_encode($errorMessage, JSON_UNESCAPED_UNICODE) ?>;
@@ -75,6 +77,19 @@ $redirectUrlUtm = $redirect_url_utm ?? '';
const fileInput = document.getElementById('dropzone-file-input'); const fileInput = document.getElementById('dropzone-file-input');
if (!formEl || !fileInput) return; if (!formEl || !fileInput) return;
// `accept` — только удобство picker. Преленд не дублирует Settings:
// разрешённый для наблюдения PDF добавляется неблокирующим запросом к API.
if (uploadPolicyApiUrl && window.fetch) {
fetch(uploadPolicyApiUrl, { credentials: 'omit', cache: 'no-store' })
.then(response => response.ok ? response.json() : null)
.then(policy => {
if (policy?.pdf_observation_enabled) {
fileInput.accept += ',.pdf';
}
})
.catch(() => {});
}
let columnsSwapped = false; let columnsSwapped = false;
formEl.addEventListener('click', (e) => { formEl.addEventListener('click', (e) => {