소스 검색

shadowban for linkedin working on mobile

tags/v1.1.4
Jonathan Cobb 4 년 전
부모
커밋
d0ba76f027
7개의 변경된 파일78개의 추가작업 그리고 27개의 파일을 삭제
  1. +2
    -1
      bubble-server/src/main/java/bubble/model/app/AppMatcher.java
  2. +1
    -1
      bubble-server/src/main/resources/META-INF/bubble/bubble.properties
  3. +0
    -1
      bubble-server/src/main/resources/bubble/rule/RequestModifierRule_icon.js.hbs
  4. +4
    -1
      bubble-server/src/main/resources/bubble/rule/social/block/JsUserBlockerRuleDriver.js.hbs
  5. +60
    -16
      bubble-server/src/main/resources/bubble/rule/social/block/site/LI.js.hbs
  6. +1
    -7
      bubble-server/src/main/resources/models/apps/user_block/li/bubbleApp_userBlock_li_data.json
  7. +10
    -0
      bubble-server/src/main/resources/models/apps/user_block/li/bubbleApp_userBlock_li_matchers.json

+ 2
- 1
bubble-server/src/main/java/bubble/model/app/AppMatcher.java 파일 보기

@@ -44,7 +44,8 @@ import static org.cobbzilla.wizard.model.crypto.EncryptedTypes.ENC_PAD;
public class AppMatcher extends IdentifiableBase implements AppTemplateEntity, HasPriority {

public static final String[] VALUE_FIELDS = {
"fqdn", "urlRegex", "template", "enabled", "priority", "connCheck", "requestCheck", "requestModifier"
"fqdn", "urlRegex", "userAgentRegex", "template", "enabled", "priority",
"connCheck", "requestCheck", "requestModifier"
};
public static final String[] CREATE_FIELDS = ArrayUtil.append(VALUE_FIELDS, "name", "site", "rule");



+ 1
- 1
bubble-server/src/main/resources/META-INF/bubble/bubble.properties 파일 보기

@@ -1 +1 @@
bubble.version=Adventure 1.1.3
bubble.version=Adventure 1.1.4

+ 0
- 1
bubble-server/src/main/resources/bubble/rule/RequestModifierRule_icon.js.hbs 파일 보기

@@ -263,7 +263,6 @@ function {{JS_PREFIX}}_chase_redirects (a, removeParams, regex, groups, callback
body: JSON.stringify(follow_body)
}
const follow_url = is_regex ? {{JS_PREFIX}}_follow_and_apply_regex_url : {{JS_PREFIX}}_follow_url;
console.log('>>>>>>>>>>>> requesting follow_url ('+follow_url+') with request_opts: '+JSON.stringify(request_opts));
fetch(follow_url, request_opts)
.then(response => is_regex ? response.json() : response.text())
.then(data => {


+ 4
- 1
bubble-server/src/main/resources/bubble/rule/social/block/JsUserBlockerRuleDriver.js.hbs 파일 보기

@@ -72,8 +72,11 @@ function {{JS_PREFIX}}_uuidv4() {

const {{JS_PREFIX}}_create_block_img = function(size) {
const img = document.createElement('img');
img.style.all = 'revert';
img.style.fontSize = 'x-small';
img.src = {{JS_PREFIX}}_asset_img_url('icon');
img.width = typeof size !== 'undefined' ? size : 24;
img.width = typeof size !== 'undefined' && size !== null ? size : 24;
img.style.width = img.width+'px';
return img;
}



+ 60
- 16
bubble-server/src/main/resources/bubble/rule/social/block/site/LI.js.hbs 파일 보기

@@ -3,6 +3,14 @@

const {{JS_PREFIX}}_site_host = location.protocol + '//' + window.location.hostname + '/';

function {{JS_PREFIX}}_mobile() {
const html = Array.from(document.getElementsByTagName('html'));
if (html.length !== 0) {
return html[0].className && html[0].className.indexOf(' mobile ') !== -1;
}
return false;
}

const {{JS_PREFIX}}_jail = document.createElement('div');
{{JS_PREFIX}}_jail.style.display = 'none';

@@ -16,7 +24,9 @@ function {{JS_PREFIX}}_apply_blocks(blocked_users) {
} else {
}
}
const articles = Array.from(document.getElementsByClassName('feed-shared-update-v2'));
const articles = {{JS_PREFIX}}_mobile()
? Array.from(document.getElementsByClassName('feed-item'))
: Array.from(document.getElementsByClassName('feed-shared-update-v2'));
if (articles === null || articles.length === 0) {
console.warn('No articles found, not filtering');
return;
@@ -35,7 +45,7 @@ function {{JS_PREFIX}}_author_from_href(linkId, callback) {
}
const link = document.getElementById(linkId);
if (link === null) {
// console.log('author_from_href: link with ID '+linkId+' not found');
console.log('author_from_href: link with ID '+linkId+' not found');
return;
}
const href = link.href;
@@ -47,12 +57,17 @@ function {{JS_PREFIX}}_author_from_href(linkId, callback) {
}
if (h.endsWith('/')) h = h.substring(0, h.length - 1);
let profile_type = null;

const mobile = {{JS_PREFIX}}_mobile();
if (mobile && h.startsWith('mwlite/')) {
h = h.substring('mwlite/'.length);
}
if (h.startsWith('in/')) {
profile_type = 'in/';
} else if (h.startsWith('company/')) {
profile_type = 'company/';
} else {
// console.log("author_from_href: skipping (not in/ or company/) href: "+href);
// console.log("author_from_href: skipping (not in/ or company/) href: "+href+', h='+h);
return;
}
const slashPos = h.indexOf('/');
@@ -127,20 +142,56 @@ function {{JS_PREFIX}}_create_block_control(article, authorName, articleLink) {

function {{JS_PREFIX}}_hash_url(url) { return btoa(url).replaceAll('=', ''); }

function {{JS_PREFIX}}_is_ad(article) {
const mobile = {{JS_PREFIX}}_mobile();
return (mobile && article.getAttribute('data-is-sponsored') && article.getAttribute('data-is-sponsored') !== "false")
|| (article.innerHTML.indexOf('<span>Promoted</span>') !== -1)
|| (article.innerHTML.indexOf('<span dir="ltr">Promoted</span>') !== -1);
}

function {{JS_PREFIX}}_find_append_span(link) {
const mobile = {{JS_PREFIX}}_mobile();
if (!mobile) {
let authorSpans = Array.from(link.getElementsByClassName('feed-shared-actor__name'));
if (authorSpans.length > 0) {
return authorSpans[0];
} else {
return Array.from(link.getElementsByTagName('span'))
.find(s => s.getAttribute('dir') === 'ltr' || s.getAttribute('data-entity-type'));
}
} else {
const ltrSpan = Array.from(link.getElementsByTagName('span'))
.find(s => s.getAttribute('dir') === 'ltr' || s.getAttribute('data-entity-type'));
if (ltrSpan) return ltrSpan;
if (link.className && link.className.indexOf('profile-link') !== -1) {
return link.lastChild;
}
}
}

function {{JS_PREFIX}}_consider_block(articles, blocked_users) {
const mobile = {{JS_PREFIX}}_mobile();
if (articles && articles.length && articles.length > 0) {
for (let i=0; i<articles.length; i++) {
const article = articles[i];
if ({{JS_PREFIX}}_is_ad(article)) {
{{JS_PREFIX}}_tally_author_block({{PAGE_PREFIX}}_msg_or_default({{JS_PREFIX}}_messages, 'web_advertOrOtherBlock', 'ad/other'));
{{JS_PREFIX}}_remove_article_from_dom(article);
continue;
}
const firstEval = {{JS_PREFIX}}_mark_evaluated(article);
if ({{JS_PREFIX}}_includes_block_keyword(article, firstEval)) {
{{JS_PREFIX}}_remove_article_from_dom(article);
continue;
}
const articleLinks = Array.from(article.getElementsByTagName('a'));
const articleLinks = mobile
? Array.from(article.getElementsByTagName('a')).filter(a => !a.hasAttribute('aria-hidden'))
: Array.from(article.getElementsByTagName('a'));
// console.log('consider_block: found '+articleLinks.length+' articleLinks');
for (let j=0; j<articleLinks.length; j++) {
const articleLink = articleLinks[j];
if (typeof articleLink === 'undefined' || articleLink === null || typeof articleLink.href === 'undefined') {
console.log('consider_block: skipping invalid articleLink: '+JSON.stringify(articleLink));
// console.log('consider_block: skipping invalid articleLink: '+JSON.stringify(articleLink));
continue;
}
if (typeof articleLink.id === 'undefined' || articleLink.id === null || articleLink.id.length === 0) {
@@ -174,17 +225,10 @@ function {{JS_PREFIX}}_consider_block(articles, blocked_users) {
{{JS_PREFIX}}_remove_article_from_dom(article);

} else if (!seenBefore) {
let appendToSpan = null;
let authorSpans = Array.from(realLink.getElementsByClassName('feed-shared-actor__name'));
if (authorSpans.length > 0) {
appendToSpan = authorSpans[0];
} else {
appendToSpan = Array.from(realLink.getElementsByTagName('span'))
.find(s => s.getAttribute('dir') === 'ltr' || s.getAttribute('data-entity-type'));
if (typeof appendToSpan === 'undefined') {
console.log('consider_block: found no span to attach block control for author: '+author);
return;
}
let appendToSpan = {{JS_PREFIX}}_find_append_span(realLink);
if (!appendToSpan) {
console.log('consider_block: no span found to append to for author '+author);
return;
}

let b = {{JS_PREFIX}}_create_block_control(article, author, realLink);


+ 1
- 7
bubble-server/src/main/resources/models/apps/user_block/li/bubbleApp_userBlock_li_data.json 파일 보기

@@ -1,12 +1,6 @@
[{
"name": "UserBlocker",
"children": {
"AppData": [{
"site": "LinkedIn",
"template": true,
"matcher": "LIMatcher",
"key": "kw:_<span>Promoted</span>",
"data": "true"
}]
"AppData": []
}
}]

+ 10
- 0
bubble-server/src/main/resources/models/apps/user_block/li/bubbleApp_userBlock_li_matchers.json 파일 보기

@@ -10,6 +10,16 @@
"fqdn": "www.linkedin.com",
"urlRegex": "/feed/",
"rule": "li_user_blocker"
}, {
"name": "LIMobileMatcher",
"site": "LinkedIn",
"template": true,
"requestCheck": true,
"requestModifier": true,
"fqdn": "www.linkedin.com",
"urlRegex": "/",
"userAgentRegex": "Mobi|Android",
"rule": "li_user_blocker"
}]
}
}]

불러오는 중...
취소
저장