芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/vendor/livewire/livewire/js/connection/index.js
import store from '@/Store' import componentStore from '../Store' import { getCsrfToken } from '@/util' export default class Connection { onMessage(message, payload) { message.component.receiveMessage(message, payload) } onError(message, status) { message.component.messageSendFailed() return componentStore.onErrorCallback(status) } sendMessage(message) { let payload = message.payload() if (window.__testing_request_interceptor) { return window.__testing_request_interceptor(payload, this) } // Forward the query string for the ajax requests. fetch( `${window.livewire_app_url}/livewire/message/${payload.fingerprint.name}`, { method: 'POST', body: JSON.stringify(payload), // This enables "cookies". credentials: 'same-origin', headers: { 'Content-Type': 'application/json', 'Accept': 'text/html, application/xhtml+xml', 'X-CSRF-TOKEN': getCsrfToken(), 'X-Socket-ID': this.getSocketId(), 'X-Livewire': true, // We'll set this explicitly to mitigate potential interference from ad-blockers/etc. 'Referer': window.location.href, }, } ) .then(response => { if (response.ok) { response.text().then(response => { if (this.isOutputFromDump(response)) { this.onError(message) this.showHtmlModal(response) } else { this.onMessage(message, JSON.parse(response)) } }) } else { if (this.onError(message, response.status) === false) return if (response.status === 419) { if (store.sessionHasExpired) return store.sessionHasExpired = true confirm( 'This page has expired due to inactivity.\nWould you like to refresh the page?' ) && window.location.reload() } else { response.text().then(response => { this.showHtmlModal(response) }) } } }) .catch(() => { this.onError(message) }) } isOutputFromDump(output) { return !!output.match(/