杂谈 | B站、腾讯、阿里,与平台用户管理。

Bilibili

这段时间好好的在B站逛了逛。众所周知腾讯的投资无疑是对于一家公司资产价值的认可,而Bilibili管理层这种在资本面前相当硬气的团队。自然是给“小破站”的用户们留下了一个“最后一片净土”的印象。

说到Bilibili的运行模式,大有“巫师财经”、“半佛仙人”这些专业人士发表的基于财报、股权结构、资金转化模式等等层面的分析在,所以这方面我就不过多赘述。而我看到不得不提的是他的客户服务模式。

阅读剩余部分 -

网络 | 解析来自Tuta.io的“机密邮件”中的病毒

起因:

在专否的论坛之中看到了一篇站长的帖子,提到了前几天他收到了一封来源于tevin@tuta.io的机密邮件,这封邮件说这是一封通过tutanota.com发送的机密邮件,然后下面有一个链接,点击打开机密邮件。站长本人留了个心,切换了网络环境————用未越狱的ios进行打开,结果无法加载,但致终没能够确定这是否是病毒。

阅读剩余部分 -

项目 | Https Browser

HTTPS Browser

Q:What is HSB?
A:HSB stands for HTTPS BROWSER. Is a lightweight, secure browser with a built-in proxy.

Functions of HSB:

1.Built-in proxy server with Always Https service, allowing you to access any page safely.
2.Convenient navigating bar design allows you to get started quickly.
3.Convenient top button parts for easy browsing .
4.Extended button keys to do more.
5.Child pornography review based on CloudFlare to help you avoid bad information
6.OpenRsap-based security scanner to help you avoid network viruses and malicious code risks.
7.Rich built-in expansion allows you to enjoy life.
8.Global video content captured by built-in robots, you can watch it if you want.
9.Global music captured by robots, listen to it if you want.
10.Image processing tools comparable to Photoshop, polish each of your photos.
11.Sliding page turning design.

Download: Github - HSB

分享 | 利用CloudFlare Workers搭建镜像站点

如何快速建立一个属于自己的谷歌学术镜像站点?

全球颇负盛名的免费CDN的服务商CloudFlare就是一个解决办法,CloudFlare Workers,这是一个能免费托管平台,并赠送访问域名。那么欲成此事必先了解他是什么
Cloudflare Workers 的名字来源于 Web Workers 以及更特别的 Service Workers,
这个 W3C 标准API 针对的是在浏览器后台运行并拦截 HTTP 请求的脚本。
Cloudflare Workers 是使用同样的标准API编写的,但是在、Cloudflare 的服务器上运行,而不是在浏览器中。

OK,一切准备就绪,开工!

0.登录CloudFlare

  1. 再打开位于网页右部的“Workers”
  2. 根据系统提示创建好自己的子域名
  3. 点击“Create a Worker”
  4. 在代码栏内粘贴以下源码
// Website you intended to retrieve for users.
const upstream = 'www.google.com'

// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = 'www.google.com'

// Countries and regions where you wish to suspend your service.
const blocked_region = ['KP', 'SY', 'PK', 'CU']

// IP addresses which you wish to block from using your service.
const blocked_ip_address = ['0.0.0.0', '127.0.0.1']

// Replace texts.
const replace_dict = {
    '$upstream': '$custom_domain',
    '//google.com': ''
}

addEventListener('fetch', event => {
    event.respondWith(fetchAndApply(event.request));
})

async function fetchAndApply(request) {

    const region = request.headers.get('cf-ipcountry').toUpperCase();
    const ip_address = request.headers.get('cf-connecting-ip');
    const user_agent = request.headers.get('user-agent');

    let response = null;
    let url = new URL(request.url);
    let url_host = url.host;

    if (url.protocol == 'http:') {
        url.protocol = 'https:'
        response = Response.redirect(url.href);
        return response;
    }

    if (await device_status(user_agent)) {
        var upstream_domain = upstream;
    } else {
        var upstream_domain = upstream_mobile;
    }

    url.host = upstream_domain;

    if (blocked_region.includes(region)) {
        response = new Response('Access denied: WorkersProxy is not available in your region yet.', {
            status: 403
        });
    } else if(blocked_ip_address.includes(ip_address)){
        response = new Response('Access denied: Your IP address is blocked by WorkersProxy.', {
            status: 403
        });
    } else{
        let method = request.method;
        let request_headers = request.headers;
        let new_request_headers = new Headers(request_headers);

        new_request_headers.set('Host', upstream_domain);
        new_request_headers.set('Referer', url.href);

        let original_response = await fetch(url.href, {
            method: method,
            headers: new_request_headers
        })

        let original_response_clone = original_response.clone();
        let original_text = null;
        let response_headers = original_response.headers;
        let new_response_headers = new Headers(response_headers);
        let status = original_response.status;

        new_response_headers.set('cache-control' ,'public, max-age=14400')
        new_response_headers.set('access-control-allow-origin', '*');
        new_response_headers.set('access-control-allow-credentials', true);
        new_response_headers.delete('content-security-policy');
        new_response_headers.delete('content-security-policy-report-only');
        new_response_headers.delete('clear-site-data');

        const content_type = new_response_headers.get('content-type');
        if (content_type.includes('text/html') && content_type.includes('UTF-8')) {
            original_text = await replace_response_text(original_response_clone, upstream_domain, url_host);
        } else {
            original_text = original_response_clone.body
        }

        response = new Response(original_text, {
            status,
            headers: new_response_headers
        })
    }
    return response;
}

async function replace_response_text(response, upstream_domain, host_name) {
    let text = await response.text()

    var i, j;
    for (i in replace_dict) {
        j = replace_dict[i]
        if (i == '$upstream') {
            i = upstream_domain
        } else if (i == '$custom_domain') {
            i = host_name
        }
        
        if (j == '$upstream') {
            j = upstream_domain
        } else if (j == '$custom_domain') {
            j = host_name
        }

        let re = new RegExp(i, 'g')
        text = text.replace(re, j);
    }
    return text;
}


async function device_status (user_agent_info) {
    var agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
    var flag = true;
    for (var v = 0; v < agents.length; v++) {
        if (user_agent_info.indexOf(agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}
  • 代码实现原理: Proxy 项目是一个轻量级的 JavaScript 应用程序,部署在 CF
    上作为客户端从其他服务器检索资源,来实现自定义反向代理的构建,而无需购买计算引擎或配置 Nginx 等 Web 服务器。 程序会通过

CF 遍布90多个国家/地区的全球数据中心网络进行分发,所以延迟和可用性将得到极大优化。
通过配置地址和IP地址过滤器可以禁止特定国家或地区使用反代服务;利用移动重定向器可以根据用户的设备来分发不同的网页。