2022年2月

刷机方法

  1. 将demo.bin考到TF卡上
  2. 將大方摄像机断电
  3. 将卡插入大方智能摄像机
  4. 按住setup键,给大方通电,setup键不要松开
  5. 等待15秒后,松开setup键
  6. 等待5分钟以上(如果大方没有自动重启,就手动插拔下电源)

实测可以成功!刷机完成后最好取出TF卡,然后重置摄像头!

下载地址

下载地址:[大方智能摄像机卡刷包.zip]

壁纸合集

Bimg.top这个网站上的图片都是以每天的文件夹命名收集的,导致产生大量的文件夹。为了方便Bing壁纸控设置壁纸,现在把所有的壁纸全部集合到一个文件夹中。
目前新加入到合集文件中的图片名称前面会加上日期,如下图:
2022-02-17-12-55-02.png
以前的图片文件名暂时没有添加日期,主要是我自己NAS中也比较混乱。
2022-02-17-12-56-44.png

获取方式

这里为了更好的方便各位壁纸控获取这个合集,特意使用Alist程序(这里特别感谢该作者,真的是网盘共享神器。)将阿里云盘中的壁纸进行分享,这样可以方便没有阿里云盘账号的壁纸控直接就可以下载无损的图片,Bing官网展示的什么格式,下载的就是什么格式。
另一种方法是有阿里云盘账号的壁纸控,可以直接通过https://www.aliyundrive.com/s/iBnYbU3zMyA这个链接进行转存,里面有两个文件夹,一个是按日期创建文件夹的,另一个是集合到一个文件夹中的,按需获取吧!

前言:所有内容均为个人经验,欢迎交流探讨。不涉及任何推广。

为什么这么玩?

以前跟风捡垃圾入手了一个华为Gi945,后来因为N270CPU实在太拉跨就一直闲置到现在。最近在使用OpenWrt路由系统的时候接触到了一个去广告的项目支就是AdGuard Home,可以运行在软路由、硬路由等设备上面的去广告服务,基于DNS。相信各位折腾各种软路由和OpenWrt的玩家们并不陌生。当然,本人的路由设备是在太差,跑AdGuard Home估计会运行困难。所以想到将AdGuard Home放到Gi945下面去跑,让Gi945作为一个DNS服务器运行。
GI945
多年前购买的Gi945
我买的是未解锁的设备,关于要刷Bios这篇文章暂时不表。想你们也不会用这么垃圾的设备

如何安装?

1.Gi945安装linux系统,我这里安装的是CentOS 7 AltArch 版本,因为各大Linux系统已经停止了对32位CPU的支持。
CentOS 7 AltArch

到Releases · AdguardTeam/AdGuardHome (github.com)下载AdGuard Home的安装文件

AdGuard Home

因为Gi945的CPU是N270为32的,所以这里选择AdGuardHome_linux_386.tar.gz进行下载安装。

CentOS下的下载命令是:wget https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.105.1/AdGuardHome_linux_386.tar.gz

AdGuardHome_linux_386.tar.gz

解压安装

在CentOS运行下载命令后接着运行以下命令:

1、解压:tar -zxvf AdGuardHome_linux_386.tar.gz 2、安装:`cd AdGuardHome &&
chmod +x AdGuardHome && ./AdGuardHome -s install 3、开放防火墙:systemctl
stop firewalld.service这里注意,电脑重启后防火墙会再次打开所以需要永久关闭,运行systemctl disable
firewalld.service`

到这里就完成了安装的过程,下面就是使用的过程啦!(手动撒花~)

如何使用?

首先,获取CentOS的IP地址,通过命令ifconfig或者 ip add。
ifconfig
我这里获取到的IP地址是:192.168.5.220。

通过访问 http://192.168.5.234:3000 进行
image-20210227162132615

点击【开始配置】

image-20210227162219839
这里直接默认点击【下一步】

image-20210227162331006
设置用户名和密码然后【下一步】

image-20210227162405263
这里是告诉你应该如何设置你的其他设备,直接【下一步】

image-20210227162452248
基本配置
到这里直接【打开仪表盘】

image-20210227162558855
输入用户名和密码登录即可!

image-20210227162639330
登录后,右下方会提示一堆错误,暂时不用管,先来配置AdGuard Home。

image-20210227162731801
进入【设置】-【常规设置】

image-20210227162811449
把过滤器的更新时间设置为【3天】,这个可以自己考虑呀!我是这样设置的。

image-20210227162906734
然后日志这里看自己喜好设置即可,我设置保存时间都是90天。

image-20210227162949590
设置完成后点击一下【保存】,右下角会提示保存成功!

重点!!!!!!
image-20210227163039853
进入【设置】-【DNS设置】

image-20210227163223275

https://dns.alidns.com/dns-query https://doh.pub/dns-query
114.114.114.114
223.5.5.5
119.29.29.29
8.8.8.8

将以上内容填进去,然后设置为(负载均衡)

image-20210227163332378
然后点击【应用】

image-20210227163357499
右下角会提示上游DNS已更新,这样就完成了基本配置。

然后测试DNS是否配置成功点击【测试上游DNS】即可。

image-20210227163517280
出现运行正常就没问题啦!

image-20210227163556293
其他的【加密设置】、【客户端设置】我默认就好了,可以根据自己的需求进行配置。

这里讲一下DHCP设置,这里就是Adguard Home内置的DHCP服务,可以接管路由器的DHCP,如果路由器开启了DHCP这里就不要开启了,避免冲突导致局域网内设备无法联网。

广告过滤配置

image-20210227163940815
到【过滤器】-【DNS封锁清单】中进行配置

image-20210227164041646
点击【添加阻止列表】-【添加一个自定义列表】

这里推荐几个:

Anti-AD https://anti-ad.net/easylist.txt Halflife
https://gitee.com/halflife/list/raw/master/ad.txt EasyList
https://easylist-downloads.adblockplus.org/easylist.txt EasyList China
https://easylist-downloads.adblockplus.org/easylistchina.txt

image-20210227164449101
其他的过滤器可以自行Google

到这里配置就已经结束了!还有补充的可以留言交流呀!

设备配置

以Windows 10为例:

image-20210227165430868
打开网络和Internet设置

image-20210227165530586
点击【以太网】

image-20210227165554652
【更改适配器选项】

image-20210227165656351
将(以太网)右击【属性】

image-20210227165853809
选择【Internet协议版本4 (TCP/IPv4)】 然后点击【属性】

image-20210227170008218
选择【使用下面的DNS服务器地址】,修改(首选DNS服务器)为:192.168.5.220这里根据你自己的IP修改。

修改完成后,就设备就配置完成了!

查看日志

image-20210227170200723
点击查询日志就能看到AdGuard Home过滤器的日志,这里显示很多内容,响应为已拦截的就是我们刚刚配置的广告过滤配置规则生效的结果。

PS.如果这里拦截了某一个并不想拦截的请求,在后面点击【放行】即可。

image-20210227170453082

效果

image-20210227170547522
刚刚修改完设备的DNS后在仪表盘就看到统计结果,发现拦截的百度(百毒)的是比较多。

总结

总体来说效果还是挺满意的,把我闲置的Gi945设备利用起来,做一个广告过滤器让整个家里的局域网干干净净。这里值得说明的是,有时候会将我的小米电视的正常内容也过滤掉,这是因为小米电视的部分内容和广告好像是一起加载的,这样的我直接点击放行就搞定了。

在咸鱼上买了一个升腾资讯的NI945W-3主板,这块板子CPU是因特尔的D2550 双核四线程1.86GHz TDP为10W。网卡是瑞昱的RTL8111E千兆网卡。主板自带一个SATA接口,可以外接一个笔记本硬盘,但是需要配套的电源线。不友好的地方是板子没有显示输出,需要自己引出VGA,也没有开机按键,同样需要自行引出。不过看在60块钱包邮的份上就下单了。毕竟这个板子是真的薄。
O1CN01gcGEDW2Ln8gB3bX8W_!!3319559736.jpg

添加VGA

首先根据下图用烙铁短接7个位置。
2021-04-01-20-00-54.png

然后对J12进行引线
2021-04-01-20-22-27.png

这样就搞定了VGA显示。
开机按键如下图:
2021-04-01-20-28-23.png
一样很简单。

刷爱快ikuai软路由

软路由我采用的是iKuai系统,使用Physical Disk进行写盘,然后装到主板的MSATA位置即可。具体可以看使用IMG写盘安装-爱快 iKuai-商业场景网络解决方案提供商 (ikuai8.com) 这一篇文章。

来电开机

这个板子进入BIOS的方法是开机后按Ctrl+Alt+ESC。
设置来电开机的方法是:CMOS Setup–>Chipset–>South Bridge–>Restore AC Power Loss–>Power On
这样就可以愉快玩耍拉!
最后附一张我装的iKuai图片。
2021-04-01-20-34-09.png

CloudFlare Workers来自官网的介绍

构建无服务器应用程序并在全球范围内即时部署,从而获得卓越的性能、可靠性和规模性。

通过创建服务可以对网站进行加速,并不是CloudFlare的CDN加速,而是通过反向代理进行的,还可以添加各种应用!

反代网站

对网站进行反代

// Website you intended to retrieve for users.
const upstream = '96dj.cn'

// Custom pathname for the upstream website.
const upstream_path = '/'

// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = '96dj.cn'

// Countries and regions where you wish to suspend your service.
const blocked_region = ['US', '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']

// Whether to use HTTPS protocol for upstream address.
const https = true

// Whether to disable cache.
const disable_cache = false

// Replace texts.
const replace_dict = {
    '$upstream': '$custom_domain',
    '//96dj.cn': ''
}

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_hostname = url.hostname;

    if (https == true) {
        url.protocol = 'https:';
    } else {
        url.protocol = 'http:';
    }

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

    url.host = upstream_domain;
    if (url.pathname == '/') {
        url.pathname = upstream_path;
    } else {
        url.pathname = upstream_path + url.pathname;
    }

    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.protocol + '//' + url_hostname);

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

        connection_upgrade = new_request_headers.get("Upgrade");
        if (connection_upgrade && connection_upgrade.toLowerCase() == "websocket") {
            return original_response;
        }

        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;
        
        if (disable_cache) {
            new_response_headers.set('Cache-Control', 'no-store');
        }

        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');
        
        if (new_response_headers.get("x-pjax-url")) {
            new_response_headers.set("x-pjax-url", response_headers.get("x-pjax-url").replace("//" + upstream_domain, "//" + url_hostname));
        }
        
        const content_type = new_response_headers.get('content-type');
        if (content_type != null && content_type.includes('text/html') && content_type.includes('UTF-8')) {
            original_text = await replace_response_text(original_response_clone, upstream_domain, url_hostname);
        } 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;
}

注意将96dj.cn换成你需要代理的网址

单页展示

还可以展示单页

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

// HTML代码
let html = `
<!DOCTYPE html>
<html>
  <head><title>Hello 96dj.cn!</title></head>
  <body><div>Hello 96dj.cn!</div></body>
</html>
`;

/**
 * Respond to the request
 * @param {Request} request
 */
async function handleRequest(request) {
  return new Response(html, {
    headers: {
      'Content-Type': 'text/html; charset=UTF-8'
    },
    status: 200
  })
}

GitHub加速

还可以对GitHub进行加速 来自https://github.com/hunshcn/gh-proxy

'use strict'

/**
 * static files (404.html, sw.js, conf.js)
 */
const ASSET_URL = 'https://hunshcn.github.io/gh-proxy/'
// 前缀,如果自定义路由为example.com/gh/*,将PREFIX改为 '/gh/',注意,少一个杠都会错!
const PREFIX = '/'
// git使用cnpmjs镜像、分支文件使用jsDelivr镜像的开关,0为关闭,默认开启
const Config = {
    jsdelivr: 0,
    cnpmjs: 0
}

/** @type {RequestInit} */
const PREFLIGHT_INIT = {
    status: 204,
    headers: new Headers({
        'access-control-allow-origin': '*',
        'access-control-allow-methods': 'GET,POST,PUT,PATCH,TRACE,DELETE,HEAD,OPTIONS',
        'access-control-max-age': '1728000',
    }),
}


const exp1 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:releases|archive)\/.*$/i
const exp2 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:blob|raw)\/.*$/i
const exp3 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/(?:info|git-).*$/i
const exp4 = /^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+?\/.+$/i
const exp5 = /^(?:https?:\/\/)?gist\.(?:githubusercontent|github)\.com\/.+?\/.+?\/.+$/i
const exp6 = /^(?:https?:\/\/)?github\.com\/.+?\/.+?\/tags.*$/i

/**
 * @param {any} body
 * @param {number} status
 * @param {Object<string, string>} headers
 */
function makeRes(body, status = 200, headers = {}) {
    headers['access-control-allow-origin'] = '*'
    return new Response(body, {status, headers})
}


/**
 * @param {string} urlStr
 */
function newUrl(urlStr) {
    try {
        return new URL(urlStr)
    } catch (err) {
        return null
    }
}


addEventListener('fetch', e => {
    const ret = fetchHandler(e)
        .catch(err => makeRes('cfworker error:\n' + err.stack, 502))
    e.respondWith(ret)
})


function checkUrl(u) {
    for (let i of [exp1, exp2, exp3, exp4, exp5, exp6 ]) {
        if (u.search(i) === 0) {
            return true
        }
    }
    return false
}

/**
 * @param {FetchEvent} e
 */
async function fetchHandler(e) {
    const req = e.request
    const urlStr = req.url
    const urlObj = new URL(urlStr)
    let path = urlObj.searchParams.get('q')
    if (path) {
        return Response.redirect('https://' + urlObj.host + PREFIX + path, 301)
    }
    // cfworker 会把路径中的 `//` 合并成 `/`
    path = urlObj.href.substr(urlObj.origin.length + PREFIX.length).replace(/^https?:\/+/, 'https://')
    if (path.search(exp1) === 0 || path.search(exp5) === 0 || path.search(exp6) === 0 || !Config.cnpmjs && (path.search(exp3) === 0 || path.search(exp4) === 0)) {
        return httpHandler(req, path)
    } else if (path.search(exp2) === 0) {
        if (Config.jsdelivr) {
            const newUrl = path.replace('/blob/', '@').replace(/^(?:https?:\/\/)?github\.com/, 'https://cdn.jsdelivr.net/gh')
            return Response.redirect(newUrl, 302)
        } else {
            path = path.replace('/blob/', '/raw/')
            return httpHandler(req, path)
        }
    } else if (path.search(exp3) === 0) {
        const newUrl = path.replace(/^(?:https?:\/\/)?github\.com/, 'https://github.com.cnpmjs.org')
        return Response.redirect(newUrl, 302)
    } else if (path.search(exp4) === 0) {
        const newUrl = path.replace(/(?<=com\/.+?\/.+?)\/(.+?\/)/, '@$1').replace(/^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com/, 'https://cdn.jsdelivr.net/gh')
        return Response.redirect(newUrl, 302)
    } else {
        return fetch(ASSET_URL + path)
    }
}


/**
 * @param {Request} req
 * @param {string} pathname
 */
function httpHandler(req, pathname) {
    const reqHdrRaw = req.headers

    // preflight
    if (req.method === 'OPTIONS' &&
        reqHdrRaw.has('access-control-request-headers')
    ) {
        return new Response(null, PREFLIGHT_INIT)
    }

    const reqHdrNew = new Headers(reqHdrRaw)

    let urlStr = pathname
    if (urlStr.startsWith('github')) {
        urlStr = 'https://' + urlStr
    }
    const urlObj = newUrl(urlStr)

    /** @type {RequestInit} */
    const reqInit = {
        method: req.method,
        headers: reqHdrNew,
        redirect: 'manual',
        body: req.body
    }
    return proxy(urlObj, reqInit)
}


/**
 *
 * @param {URL} urlObj
 * @param {RequestInit} reqInit
 */
async function proxy(urlObj, reqInit) {
    const res = await fetch(urlObj.href, reqInit)
    const resHdrOld = res.headers
    const resHdrNew = new Headers(resHdrOld)

    const status = res.status

    if (resHdrNew.has('location')) {
        let _location = resHdrNew.get('location')
        if (checkUrl(_location))
            resHdrNew.set('location', PREFIX + _location)
        else {
            reqInit.redirect = 'follow'
            return proxy(newUrl(_location), reqInit)
        }
    }
    resHdrNew.set('access-control-expose-headers', '*')
    resHdrNew.set('access-control-allow-origin', '*')

    resHdrNew.delete('content-security-policy')
    resHdrNew.delete('content-security-policy-report-only')
    resHdrNew.delete('clear-site-data')

    return new Response(res.body, {
        status,
        headers: resHdrNew,
    })
}