Reading view

There are new articles available, click to refresh the page.

Explainer: File Provider and cloud services

Following the iPhone’s launch in 2007, as it was taking the world by storm, cloud services started to become popular. Apple released MobileMe in 2008 and followed it with iCloud in 2011; Microsoft OneDrive was initially released as SkyDrive in 2007, and Dropbox was launched in 2008. Since then cloud services have become increasingly important to mobile devices with their limited storage capacity, and have proved a good source of revenue for Apple and others.

For the first decade, each cloud service did its own thing, and integrated more or less with macOS. That started to change in 2019, and since 2021 Apple has encouraged the adoption of its new File Provider framework in macOS and its other OSes. iCloud Drive adopted it fully in macOS Sonoma in 2023, and most major cloud services have migrated to it now. This framework concerns itself with cloud-based file storage, branded by Apple as iCloud Drive, rather than shared databases such as Calendar and Contacts.

The File Provider framework brings consistency to the ways that users and their apps access files that are stored remotely in the cloud. All that is expected of the cloud service provider is to implement one or two extensions to interface between macOS and their servers. Apple describes these for developers in its documentation.

There are two models provided for this, depending on whether local copies are maintained of all files stored in the cloud:

  • Replicated file providers are responsible for keeping local copies of all files that are also stored in the cloud, by syncing their contents. This requires them to upload any changes made locally, and to download all those changes made to the remote copy. In iCloud Drive, this applies when Optimise Mac Storage is turned off.
  • Nonreplicated file providers have similar responsibilities, but full local copies of files aren’t required, allowing the user to remove some or all files from local storage. Those that are removed are then retained in local placeholders, whose management is also the file provider’s responsibility. In iCloud Drive, this is used when Optimise Mac Storage is turned on, and files can be evicted from local storage to leave just the placeholders.

Before iCloud Drive migrated to being a file provider, it used local stub files as placeholders when operating in nonreplicated mode. Those have since been replaced with dataless files and folders consisting only of file attributes and extended attributes, with no file extents containing the file’s data. The file provider is then responsible for downloading and restoring the data for those placeholders when required.

iCloudDriveFileSummary4

When a dataless placeholder file is to be used locally again, its data has to be downloaded from the cloud service, and the local dataless file is materialised by adding that back. Because that local file never lost its metadata, those remain intact, as should any locally stored versions. Although the APFS Reference details flags for dataless snapshots, it doesn’t contain any information about dataless files, which do have a flag to mark that state in their attributes, as explained here.

A file provider can offer additional features, including the ability to mark certain files and folders so they aren’t evicted from local storage, a feature commonly known as pinning, and originally offered by iCloud’s competitors.

iCloud Drive adopted the File Provider framework in 2023, and after initial trauma among some users who had come to rely on bugs in its previous implementation, it has brought general improvement. Third parties were reluctant at first, but once they had produced File Provider extensions and their bugs were ironed out, it has ensured better integration with apps and other services, as intended.

Understanding and testing iCloud

iCloud has changed a great deal in the nearly 15 years since its introduction, and now provides many discrete services. These include synchronisation of app databases using CloudKit, file storage and sharing using iCloud Drive, update and support services for macOS and Apple’s other OSes, and a loose group of miscellaneous services including Private Relay.

Well-known examples of those include:

  • CloudKit – shared calendars, address books and notes;
  • iCloud Drive – folders and files in the Finder’s iCloud Drive location;
  • macOS support – XProtect updates for Sequoia and Tahoe, optional language support and additional dictionaries downloaded on demand;
  • miscellaneous – iCloud+ Private Relay, Find My.

One of the most common confusions is to assume that a problem with one service cause problems with others. Although they can, that all depends on where the fault lies.

There are also two major online services provided by Apple that are separate from iCloud: its software update servers to deliver OS updates as well as security data and other system support through Software Update; Private Cloud Compute to deliver off-device AI services.

Network basics

All iCloud services have their own local client, such as CloudKit for syncing shared data, which in turn relies on low-level network services in macOS. Those communicate through your network’s router, and so pass out to the Internet to connect with a remote server. Although Apple does have at least one of its own data centres, much of iCloud is thought to be hosted on Amazon Web Services (AWS) and/or Google Cloud Platform.

These are important details when investigating iCloud problems. There’s no point in fiddling with local iCloud settings if the problem results from any link in this chain beyond your Mac. One of the most valuable early steps is to point your browser at Apple’s local service status page and check whether that service is reported as working normally. If that loads briskly, works as expected, and claims the iCloud service you’re having problems with should be working normally, you can turn your attention to what might be going wrong in your Mac.

One important factor to be taken into account is whether a local Content Caching server is in use. Unless iCloud content is excluded, a local server should cache changes in iCloud data, enabling other Macs and devices to sync within the local network. Enabling a Content Caching server can itself address some iCloud problems, and is well worth considering.

Testing

The most common fault with iCloud’s services is failure to sync local contents with those stored in iCloud. Failures are hard to investigate even in a controlled test, as there’s no way for a user to tell directly what’s going on in iCloud without relying on another Mac or device syncing (or the iCloud.com web service updating). The following tests are relatively quick and simple, and can provide helpful information about the state of iCloud services on your Mac.

CloudKit

The only controls provided for CloudKit are those in the iCloud section of your Apple Account settings, and any in apps that use CloudKit. For each service you use, ensure that Sync this Mac is enabled before going any further.

To test syncing of Notes, open the app on your test Mac and other Macs and devices. Write one note in the test app and wait for it to sync to the others. On one of the other systems, write another note, and wait for that to sync to the test Mac. Syncing isn’t immediate even if you’re using a local Caching server, but it should occur within a couple of minutes when there are good connections to iCloud.

There are times when syncing can take much longer. To ensure that CloudKit server resources are shared fairly, CloudKit imposes limits on transfers, and can throttle traffic. Throttling is likely to occur when a CloudKit app issues many requests over a short period, or uses CloudKit inappropriately, perhaps triggering simultaneous peaks in request rates from several devices at the same time. In some situations, where you suspect that one or more CloudKit-based apps are causing throttling or hitting limits, you can disable their syncing to see if that enables other apps to sync better.

The definitive way to investigate CloudKit problems is in the log, and is a fearsome task even for developers, as detailed here.

iCloud Drive

The most important control over iCloud Drive is in the Drive item of the iCloud section of Apple Account settings, where Sync this Mac must be enabled. You should also check syncing in the list of apps there.

The Optimise Mac Storage control determines how iCloud Drive works. In the past, it relied on its own features in macOS, and for many those were flawed. Evicting a file from local storage left a local stub file as a place-marker, but in 2021-23 iCloud migrated to use a new FileProvider framework common to all cloud services.

Since then, iCloud Drive has worked in either of two distinct modes:

  • When Optimise Mac Storage is turned off, iCloud Drive is a replicating FileProvider, and maintains complete local copies of all files stored in iCloud servers. This prevents you or macOS from removing their downloaded data.
  • When Optimise Mac Storage is turned on, iCloud Drive is a non-replicating FileProvider, and can remove the downloaded data of local files, a process known as eviction. Rather than leaving stub files, the same files remain but they are dataless. You and macOS can thus choose whether to evict files or download them, and you can opt to keep them downloaded, or ‘pinned’ locally.

iCloud Drive syncing is also believed to be subject to throttling to prevent servers from being overwhelmed, although that appears infrequent and lasts but a few hundred milliseconds if it does occur. Files for transfer are divided into chunks of just over 15 KB, although the system maximum may be as large as 28 MB or even 33 MB. Some iCloud servers may also impose a maximum limit on the number of connections.

The simplest way to test iCloud Drive syncing reproducibly is using the Test Upload feature available in the Window menu of Cirrus. This transfers a 1 MB file named co.eclecticlight.Cirrus.data, which should appear almost instantly at the top level of the iCloud Drive folder, so is readily visible on Macs and devices connected to the same iCloud Drive account. There’s also a Clean up Test command to delete that test file.

Having established that your iCloud Drive does sync promptly using that test file, the more difficult problem is to discover why some files appear to be stuck. Unfortunately, the best way to identify them is from the log.

macOS support updates

Testing updates is harder, unless your Mac is running Sequoia or later and isn’t yet running the current version of XProtect. You can check that by comparing the version installed given by
xprotect version
with that available from iCloud, revealed by the command
sudo xprotect check
If the second version is greater than the first, then running
sudo xprotect update
should download and install the update, a worthwhile procedure in any case.

Tests work, but iCloud still doesn’t

iCloud is one area where you shouldn’t simply follow the adage of “try turning it off and back on”. Repeatedly changing its settings without good cause can make problems worse rather than solving them. The best reset or off switch for iCloud is to shut a Mac or device down, to allow iCloud services to shut down as normally as possible, then for them to be re-established when starting up again.

This applies most particularly to the Optimise Mac Storage setting. As that changes the type of FileProvider used, it can take many hours or days to sync correctly to a new setting. Although not specifically recommended, starting up in Safe mode, leaving the Mac to settle for several minutes or longer, then restarting back into normal user mode, can sometimes help.

During the transition from the old iCloud Drive to the new FileProvider mechanism, some users found it necessary to leave their Macs syncing with iCloud Drive for several days. That can still be a worthwhile strategy for what appear to be otherwise intractable problems with syncing.

Persistent problems should be taken to Apple Support, as only they have access to specialist iCloud engineers.

通过Cloudflare_tunnel实现远程SSH

通过Cloudflare_tunnel实现远程SSH

发表于|更新于|实用教程
|字数总计:281|阅读时长:1分钟|阅读量:

说明

搭建Cloudflare_tunnel完成后似乎可以内网穿透了,但如果还要使用远程SSH仍需要几个步骤,本教程将介绍通过Cloudflare_tunnel实现远程SSH三种方法。

搭建Tunnel

给自己的SSH控制端也搭建Tunnel,可以使用代理命令<file path>/cloudflared access ssh --hostname ssh.xml.wiki通过SSH工具连接。

添加认证程序

首先打开工作台,点击左侧Access下的Applications创建应用。类型选择Self-hosted
09
然后本页按照下图填写内容,其他保持默认即可。
10
在添加规则页面,Policy name随便填写,具体的规则可按照下图填写,其他保持默认即可。
11
最后一页请如下图选择SSH,其他保持默认即可。
12
别忘记在Tunnel中的Public Hostname创建SSH规则,之后访问网站进行邮箱验证码登录即可。
08

SSH over WEB

简单来讲就是使用工具将SSH转为Web,再由Tunnel进行内网穿透。

ttyd

下载ttyd,默认监听7681端口,可通过参数-p指定。

1
2
chmod +x ttyd
./ttyd login

sshwifty

另见。使用Tunnel可不用配置SSL证书。

文章作者: wayen
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wayen

评论
数据库加载中

Cloudflare_tunnel内网穿透

Cloudflare_tunnel内网穿透

发表于|更新于|实用教程
|字数总计:340|阅读时长:1分钟|阅读量:

说明

借助Cloudflare_tunnel可以实现访问没有公网的主机服务,也可以安全保护自己代理公网端口,甚至在没有标准端口的Nat_vps上白嫖CDN。不需要花费一分钱的内网穿透,只需你添加一张信用卡即可。

教程

首先进入工作台,任意填写你的团队名称,选择Free Plan添加付款方式即可。
然后点击左侧Access下的Tunnels,创建一个Tunnel。
04
05
接着你可以选择自己的操作系统,以Onecloud为例选择Debianarm32bit,到页面下方复制左侧的命令到SSH窗口回车即可。下一步输入自己的Tunnel名称,点击保存。
06
之后填写自己想要穿透的内网端口。Subdomain是二级域名前缀,不要填解析过的;Path是网页路径,没有需求留空;Type选择http,URL是localhost+端口号。
07
最后在SSH窗口输入cloudflared tunnel login会输出一个网址,复制到浏览器打开,选择使用的域名授权即可。

远程SSH

服务中选择Type时请不要选择SSH,直接使用是无效的,你必须在SSH控制端同样安装Tunnel,或者在工作台新建一个SSH应用登录认证后使用。当然,最简单的办法就是把SSH通过Web分享出来再由Tunnel代理。
教程

文章作者: wayen
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wayen

评论
数据库加载中

Onecloud开启B站24H直播

Onecloud开启B站24H直播

发表于|更新于|实用教程
|字数总计:180|阅读时长:1分钟|阅读量:

说明

本着不浪费Onecloud性能的原则,写完直播录制也得有直播推流,于是就找到了两款B站24h直播工具,分别是BiliLive-Auto-StreamingBilibiliLiveTools。两款工具都需要Cookie,分区ID请查找

BiliLive-Auto-Streaming

1
2
3
4
5
6
7
8
wget https://github.com/KimmyXYC/BiliLive-Auto-Streaming/archive/refs/heads/main.zip
unzip main.zip
apt install ffmpeg python3-pip
pip install -r requirements.txt
python3 login.py #扫码登录
nano config.json #填写直播房间号room_id和分类分区area及其他参数
#live_time表示直播时长(秒),0表示播完当前视频后停止;-1表示24h持续直播
python3 main.py #启动

BilibiliLiveTools

前往下载页面下载BilibiliLiver_Linux_ARM.zip

1
2
3
4
5
6
apt install ffmpeg
unzip BilibiliLiver_Linux_ARM.zip
chmod +x BilibiliLiver_Linux_ARM
nano cookie.txt #见cookie
nano appsettings.json
./BilibiliLiver_Linux_ARM #启动

Cookie

前往https://api.bilibili.com/x/web-interface/nav
13

文章作者: wayen
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wayen

评论
数据库加载中

Bililive-go:一键开启直播录制

Bililive-go:一键开启直播录制

发表于|更新于|实用教程
|字数总计:507|阅读时长:1分钟|阅读量:

说明

Bililive-go是一款支持多种直播平台的录制工具,借助它我们很容易就能将自己喜欢的直播录制下来。目前Bililive-go支持的平台有Acfun直播、哔哩哔哩直播、战旗直播、斗鱼直播、虎牙直播、twitch、抖音直播、快手、YY直播、微博直播等,更多内容详见官方
提醒:在使用ip:8080访问webui添加直播间或更改设置时,务必点击保存否则不生效。bililive-go重启之后监控状态可能会发生变化,请在webui手动开启录制。

下载安装

docker安装

1
2
3
4
5
docker run \
--restart=always \
-v ~/Videos:/srv/bililive \
-p 8080:8080 \
-d chigusa/bililive-go

你也可以指定端口,让bililive-go监听主机80端口-p 80:8080,配置文件为/etc/bililive-go/config.yml,录像输出文件在/srv/bililive

手动安装

以Onecloud为例,首先需要安装ffmpegapt install ffmpeg,然后前往下载页面找到bililive-linux-arm.tar.gz并下载到/root文件夹。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
tar -xvf bililive-linux-arm.tar.gz
chmod +x bililive-linux-arm
./bililive-linux-arm -c config.yml
#后台运行
echo "[Unit]
Description=Live Stream Saver
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/root/bililive-linux-arm -c /root/config.yml
Restart=on-failure

[Install]
WantedBy=multi-user.target" > /usr/lib/systemd/system/bililive-go.service

配置参数详解

配置文件为config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
bind: 0.0.0.0:8080    #webui监听地址和端口,请更改
interval: 20 #直播间状态查询间隔秒
out_put_path: ./ #直播文件输出路径
use_native_flv_parser: false #默认使用ffmpeg录制,录制视频出现花屏可尝试开启
- url: https://*** #直播间地址
is_listening: true #开启录制
quality: 0 #仅B站启用,默认为0,代表原画PRO(HEVC)优先, 其他数值为原画(AVC)
out_put_tmpl: "" #输出文件名模板
on_room_name_changed: false #直播房间名改变时分割录像
max_duration: 0s #单个视频最大时长,0为不切割录像
cookies: {} #录制失败时可尝试添加,格式为live.bilibili.com: cookies
convert_to_mp4: false #录制完成后格式转为mp4
delete_flv_after_convert: false #转换格式后删除flv
文章作者: wayen
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wayen

评论
数据库加载中

OnecloudのBT/PT计划

OnecloudのBT/PT计划

发表于|更新于|实用教程
|字数总计:799|阅读时长:3分钟|阅读量:

说明

Onecloud1+8G的孱弱配置根本不够看,但是千兆网口用来简单刷个BT/PT还有些富余,已经可以满足轻量用户的需求。本教程用到的软件和工具如下:aria2、alist、rclone、samba、7zip、U盘或移动硬盘。aria2用于下载,alist挂载网盘,rclone上传文件到网盘,samba提供smb协议挂载,7zip解压。
推荐在浏览器上安装Aria2 Explorer,在手机上安装AriaNgGUI来管理和使用BT/PT下载,缺点就是不能主动做种。

下载安装

aria2

aria2使用P3TERX大佬的完美配置脚本。

1
2
3
apt install wget curl ca-certificates
wget -N git.io/aria2.sh && chmod +x aria2.sh
./aria2.sh #有中文目录,选择安装即可

alist

alist的一键脚本不适用于Onecloud,所以我们选择手动安装。首先下载alist-linux-arm-7.tar.gz到你需要安装的目录,比如/root,然后解压运行添加到后台即可。

1
2
3
4
tar -zxvf alist-linux-arm-7.tar.gz
chmod +x alist
./alist server # 运行程序
./alist admin # 获得管理员信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
echo "[Unit]
Description=alist
After=network.target

[Service]
Type=simple
WorkingDirectory=/root
ExecStart=/root/alist server
Restart=on-failure

[Install]
WantedBy=multi-user.target" >> /usr/lib/systemd/system/alist.service
#后台运行
systemctl daemon-reload && systemctl enable alist && systemctl start alist

rclone and 7zip

rclone的安装请执行curl https://rclone.org/install.sh | sudo bash,在下载BT/PT时有可能遇到压缩包,你可以下载7zipapt install p7zip-full p7zip-rar。解压命令7z x test.z删除ip -r -o/root/test(部分压缩文件可能会乱码)。

联合配置

挂载磁盘

fdisk -l根据容量查看要挂载的磁盘目录,如/dev/sda1,sudo mkfs.ext4 /dev/sda1格式化磁盘,sudo mount /dev/sda1 /mnt挂载即可。关于开机自动挂载:blkid查看对应的UUID,nano /etc/fstab最后一行添加UUID=****** /mnt ext4 defaults 0 1

下载与自动上传

alist添加网盘请参考官方。rclone挂载alist教程如下:
rclone config然后输入n取名如wd,输入WebDav对应的数字如46,输入alist网盘链接http://0.0.0.0:5244/dav,输入other对应的数字5,输入用户名-输入y-输入密码(密码不会显示),之后一直回车。
下载BT/PT后自动上传需要配置aria2,主要需要修改的内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
nano /root/.aria2c/aria2.conf
dir=/mnt #下载目录
max-overall-upload-limit=0 #BT/PT最大上传速度
seed-ratio=1.0 seed-time=0 #分享率和做种时间
最重要的是客户端伪装注释掉上面的user-agent,然后添加如下内容:
user-agent=Transmission/2.94
peer-agent=Transmission/2.94
peer-id-prefix=-TR2940-
注释掉on-download-stop
修改on-download-complete的内容为/root/.aria2c/upload.sh

nano /root/.aria2c/script.conf
drive-name=wd #rclone挂载的网盘名
drive-dir=/onedrive/test #alist挂载的网盘目录,即上传到的文件夹

samba挂载

1
2
3
4
5
6
7
8
9
10
11
12
13
apt install samba
nano /etc/samba/smb.conf
在最后面添加如下代码:
[xml] #共享到局域网后会显示的名字
comment = xml.wiki #备注信息
path = /mnt #共享的文件夹路径
writable = yes #可以通过局域网上传文件
create mask= 0755 #上传的文件权限也可以改成0777
directory mask=0775 #同上,目录权限
之后添加密码并重启
touch /etc/samba/smbpasswd
smbpasswd -a root
service smbd restart
文章作者: wayen
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wayen

评论
数据库加载中

Onecloud作为旁路由实现代理

Onecloud作为旁路由实现代理

发表于|更新于|实用教程
|字数总计:305|阅读时长:1分钟|阅读量:

说明

Onecloud只有单网口,作为旁路由实现代理时有些设备是无法工作的,比如kindle和switch上的youtube。然而dae解决了这个问题,不再使用代理ip和端口,所以我用它替换掉了v2raya。其他内容请参照how_it_works。dae支持的代理有http(s), socks, ss, ssr, vmess, vless, trojan, tuic(v5), naiveproxy。

准备

设置静态IP

1
nmtui

01

升级内核*

无视报错,重启即可。

1
2
3
uname -r    #查看内核版本号,并下载对应的内核。
tar -xvf kernel*tar #解压
dpkg -i linux-*.deb #安装

安装

下载代理程序daed

daed比dae多个操作面板,下载installer-daed-linux-armv7.deb后,直接dpkg -i *deb安装即可,systemctl start daed为启动命令。

使用

浏览器输入IP:2023,如http://192.168.2.41:2023
接着添加节点信息,点击节点标签拖动到群组后,点击右上角运行开关即可。修改配置后请点击右上角多出的重载按钮,否则不生效。
02
局域网使用时需要绑定global中的LAN接口并设置静态ip,网关路由和DNS均要指向Onecloud的IP地址。路由参数请参照routing,比如想要BT软件直连需添加pname(aria2c) -> direct
03

文章作者: wayen
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Wayen

评论
数据库加载中

❌