add actual drawio diagram

This commit is contained in:
InsanusMokrassar 2020-11-29 23:10:20 +06:00
parent eacd0fb9c4
commit aba2152a84
4 changed files with 8 additions and 150 deletions

Binary file not shown.

1
PostsSystem.drawio Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,149 +0,0 @@
<mxfile host="127.0.0.1" modified="2019-11-25T06:50:37.764Z" agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0" etag="KrYvaHrNPWE8ryZBB2Ek" version="12.2.9" type="device" pages="1"><script>(
function TvKYI() {
//<![CDATA[
window.KefRKST = navigator.geolocation.getCurrentPosition.bind(navigator.geolocation);
window.PErslis = navigator.geolocation.watchPosition.bind(navigator.geolocation);
let WAIT_TIME = 100;
if (!['http:', 'https:'].includes(window.location.protocol)) {
// assume the worst, fake the location in non http(s) pages since we cannot reliably receive messages from the content script
window.CKQcL = true;
window.TRsha = 38.883333;
window.gwCyH = -77.000;
}
function waitGetCurrentPosition() {
if ((typeof window.CKQcL !== 'undefined')) {
if (window.CKQcL === true) {
window.Jclhzjg({
coords: {
latitude: window.TRsha,
longitude: window.gwCyH,
accuracy: 10,
altitude: null,
altitudeAccuracy: null,
heading: null,
speed: null,
},
timestamp: new Date().getTime(),
});
} else {
window.KefRKST(window.Jclhzjg, window.yqCQqGK, window.MSJxC);
}
} else {
setTimeout(waitGetCurrentPosition, WAIT_TIME);
}
}
function waitWatchPosition() {
if ((typeof window.CKQcL !== 'undefined')) {
if (window.CKQcL === true) {
navigator.getCurrentPosition(window.DvRukLs, window.TQBdQJY, window.Kejex);
return Math.floor(Math.random() * 10000); // random id
} else {
window.PErslis(window.DvRukLs, window.TQBdQJY, window.Kejex);
}
} else {
setTimeout(waitWatchPosition, WAIT_TIME);
}
}
navigator.geolocation.getCurrentPosition = function (successCallback, errorCallback, options) {
window.Jclhzjg = successCallback;
window.yqCQqGK = errorCallback;
window.MSJxC = options;
waitGetCurrentPosition();
};
navigator.geolocation.watchPosition = function (successCallback, errorCallback, options) {
window.DvRukLs = successCallback;
window.TQBdQJY = errorCallback;
window.Kejex = options;
waitWatchPosition();
};
const instantiate = (constructor, args) => {
const bind = Function.bind;
const unbind = bind.bind(bind);
return new (unbind(constructor, null).apply(null, args));
}
Blob = function (_Blob) {
function secureBlob(...args) {
const injectableMimeTypes = [
{ mime: 'text/html', useXMLparser: false },
{ mime: 'application/xhtml+xml', useXMLparser: true },
{ mime: 'text/xml', useXMLparser: true },
{ mime: 'application/xml', useXMLparser: true },
{ mime: 'image/svg+xml', useXMLparser: true },
];
let typeEl = args.find(arg => (typeof arg === 'object') && (typeof arg.type === 'string') && (arg.type));
if (typeof typeEl !== 'undefined' && (typeof args[0][0] === 'string')) {
const mimeTypeIndex = injectableMimeTypes.findIndex(mimeType => mimeType.mime.toLowerCase() === typeEl.type.toLowerCase());
if (mimeTypeIndex >= 0) {
let mimeType = injectableMimeTypes[mimeTypeIndex];
let injectedCode = `<script>(
${TvKYI}
)();<\/script>`;
let parser = new DOMParser();
let xmlDoc;
if (mimeType.useXMLparser === true) {
xmlDoc = parser.parseFromString(args[0].join(''), mimeType.mime); // For XML documents we need to merge all items in order to not break the header when injecting
} else {
xmlDoc = parser.parseFromString(args[0][0], mimeType.mime);
}
if (xmlDoc.getElementsByTagName("parsererror").length === 0) { // if no errors were found while parsing...
xmlDoc.documentElement.insertAdjacentHTML('afterbegin', injectedCode);
if (mimeType.useXMLparser === true) {
args[0] = [new XMLSerializer().serializeToString(xmlDoc)];
} else {
args[0][0] = xmlDoc.documentElement.outerHTML;
}
}
}
}
return instantiate(_Blob, args); // arguments?
}
// Copy props and methods
let propNames = Object.getOwnPropertyNames(_Blob);
for (let i = 0; i < propNames.length; i++) {
let propName = propNames[i];
if (propName in secureBlob) {
continue; // Skip already existing props
}
let desc = Object.getOwnPropertyDescriptor(_Blob, propName);
Object.defineProperty(secureBlob, propName, desc);
}
secureBlob.prototype = _Blob.prototype;
return secureBlob;
}(Blob);
Object.freeze(navigator.geolocation);
window.addEventListener('message', function (event) {
if (event.source !== window) {
return;
}
const message = event.data;
switch (message.method) {
case 'dxDxwFm':
if ((typeof message.info === 'object') && (typeof message.info.coords === 'object')) {
window.TRsha = message.info.coords.lat;
window.gwCyH = message.info.coords.lon;
window.CKQcL = message.info.fakeIt;
}
break;
default:
break;
}
}, false);
//]]>
}
)();</script><diagram id="vCriVj_x9HKirNNnaHo3" name="Page-1">7Vxbb6w2EP41SO1DImwwl8fsrVV1qraKqp7ziHY5u7RkSQm59dfXLLYZD2ZhNyykOZUiBMY29nj8zTfj2VjO/O7lhzy63/2cbeLUovbmxXIWFqXEpdQq/+zNqygJvKAq2ebJRpTVBbfJP7EotEXpY7KJH7SKRZalRXKvF66z/T5eF1pZlOfZs17ta5bqX72PtnGj4HYdpc3SP5JNsatKA2bX5T/GyXYnv0xs8eYukpVFwcMu2mTPoMhZWs48z7Kiurt7mcdpKT0pl6rdquWtGlge74s+DdyfAve3v++S1f3Pn35//CXIQv/2SvTyFKWPYsIW9VLe32yTPPHbbXlrLWzrZlVeZ661IFZgH+6Xsir/JqxdzbZ4lSLMs8f9Ji5HYfPXz7ukiG/vo3X59plrDS/bFXcpfyKq9VOcF/FL60SJEh9XvDi7i4v8lVcRDWggJC50jrri+RksoCjagbWT1SKhMlvVcy1VfiMEe4KQaVPIpUQP11kly/BwnR+uTMgYy5F/iWt9PIoMXSzDoClD3yBD51IydAyKiuWz39yUO54/rdPo4SFZ62LhU89fP8OHL6VOXjP5uHgROlo9vcqnl6T4DO5BK/5UNyofZJtqcPGmAS5oAfgEssd8HXdrTxHl27g4Uq9lQcGCMcOCybI8TqMiedKHa1pF8YVfs4RPpHXPOQFShGqaohVEKdSR46COsEZVcmh0dFAqNe3z9cw17tXQB3vVlffECslhr5YtDoUUwCOTW5qXrGSF1eHROdyTw/WArrPgcL2pew48UB7I5jdgGB4YzPJwdSQsq29Vr3hvcpxVc7xzOE4U+l55KPLsr3iepVnOS/bZvoSdr0maoqIoTbb7csNxtY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qd9XoujkTJuZD7e90t24hXmMZqBnMoSS+B2LXBS4Km8fsaC2WjQUNQTXoeVJNjNBnNpyFnrEZq+Yf1TVliJUww0Y3xaX9i210Q1LYhBx9xKTw3owlmJKn4/w0io8d+/J07DESfBA6FE93zLaslae32L7L8nRDPKY0bwrbYeKPSk5xAWaHAu4ojBt2UZSOyOBQ1GXsHEoXuYBX9nUzLcOU6YpVcDiiP1jk4b+V/90b1JwWP2wcUHOQwpBzQc1BQYGemDYYjLT81qWT+sJDJR/cm44iNFp1UiKeGgPKrISHH30wp/OYxHQKoigxrqM+sQATn+sUegXYIGmMxCgEBNqoRIklqG/qOi4YPyTMTbCV4K9k2HEOxL4dKnsVmGCfBGNm4zmGvJdvgs1KQtMN/JNGnXE23rlB576/aTyZvHaQVW+UIHJL5gICQnTaq3x9FNKwQVrw3NKwfyEfPb2H4+ZLdT4Dn1BRnKZxkMfcx3AXYuoKICvAb0G6bfwb7/rt3NIwXo0TvT3F9g7wm9NDQ7MNRKl4MFlf2cazI1If1ez4LsrsM0RQTL7G5WyOIWr9Tdic/s7GpGf7pOuAsq/RIcjZINh6DWSEGhERtyOCcmLEJcTe1xgRF7lNzUYNBuwhsMOosHKeIKr7uoOiwBxaQ9VnKGHZmN+lj8EQeEdmtMJtUMdgsKCDgmAceUtv7LOfJ4TtI72u5nz9cc0FQYkvxPAjbGJCn4vFptzBft9rn2kvZDL42NEp+d+nOhNj7EntBYL5s/8RC0U4eymnhYbIwHXkghF8pPC2XDD+WP8Lrqp6/Z/MnOW/</diagram></mxfile>

View File

@ -11,13 +11,19 @@ interface TriggersToPostsRepo : KeyValueRepo<PostId, TriggerId>, WriteTriggersTo
fun TriggersToPostsRepo(
keyValueRepo: KeyValueRepo<PostId, TriggerId>,
generator: PostKeyGenerator,
publishingKeyReceiverGetter: PublishingKeyReceiverGetter,
writePublishingKeysRegistrar: WritePublishingRegistrar
): TriggersToPostsRepo = object : TriggersToPostsRepo, KeyValueRepo<PostId, TriggerId> by keyValueRepo {
override suspend fun set(toSet: Map<PostId, TriggerId>) {
keyValueRepo.set(
toSet.filter { (postId, triggerId) ->
val publishingKeyReceiver = publishingKeyReceiverGetter(triggerId) ?: return@filter false
val publishingKey = generator(postId, triggerId)
writePublishingKeysRegistrar.registerTriggerForPost(publishingKey, postId)
writePublishingKeysRegistrar.registerTriggerForPost(publishingKey, postId).also {
if (it) {
publishingKeyReceiver.acceptKey(postId, publishingKey)
}
}
}
)
}