惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
Webroot Blog
Webroot Blog
GbyAI
GbyAI
S
SegmentFault 最新的问题
Cyberwarzone
Cyberwarzone
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 【当耐特】
S
Secure Thoughts
酷 壳 – CoolShell
酷 壳 – CoolShell
AWS News Blog
AWS News Blog
Engineering at Meta
Engineering at Meta
S
Security Affairs
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
T
Threatpost
Forbes - Security
Forbes - Security
C
Cisco Blogs
Scott Helme
Scott Helme
Attack and Defense Labs
Attack and Defense Labs
Simon Willison's Weblog
Simon Willison's Weblog
腾讯CDC
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
Last Week in AI
Last Week in AI
Recorded Future
Recorded Future
小众软件
小众软件
V
Vulnerabilities – Threatpost
美团技术团队
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News - Newest:
Hacker News - Newest: "LLM"
I
Intezer
月光博客
月光博客
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 司徒正美
C
Cybersecurity and Infrastructure Security Agency CISA
Martin Fowler
Martin Fowler
博客园 - 聂微东

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟 从Python转向Pharo https://blog.just4fun.site/post/iot/iot-open-source-projects/ Python异步编程笔记 https://blog.just4fun.site/post/iot/iot-open-source-hardware-community/ 万物积木化开发者社区 CodeLab ❤️ Blender Scratch3技术分析之云变量 API(第7篇) [译]对管道(Pipes)的偏爱 [译]提出正确的问题比得到正确答案更重要 蓝牙设备与Scratch3.0 创建你的第一个Scratch3.0 Extension Scratch3技术分析之项目内部数据(第6篇) Scratch3技术分析之社区 API(第5篇) Scratch3技术分析之User API(第4篇) Scratch3技术分析之项目主页API(第3篇) Scratch3技术分析之静态资源API(第2篇) Scratch3.0、micro:bit与Windows7 https://blog.just4fun.site/post/iot/zerynth-vs-micropython/ 核聚变、方所与半宅空间 可视化编程为何是个糟糕的主意 codelab.club周末聚会 关于codelab.club '下一件大事'是一个房间 Hungry Robot - Eat everything 编程作为一种思考方式 今日简史 史蒂夫·乔布斯传 罗素自选文集 https://blog.just4fun.site/post/edx/tianjin-scratch-ai/ https://blog.just4fun.site/post/edx/richie-cms-openedx/ 徒步武功山 WebUSB与micro:bit 积木化编程与3D场景 夜宿武功山顶 scratch3-adapter接入优必选Alpha系列机器人 https://blog.just4fun.site/post/edx/video-migration-note/ scratch3-adapter重构笔记 https://blog.just4fun.site/post/edx/edx-community-members/ 两种硬件编程风格的比较 使用micro:bit自制PPT翻页笔 柏拉图对话集 scratch3.0 + micro:bit 七月电影放映计划 非营利组织的管理 Screenly--用树莓派让任何屏幕变为可编程的数字标牌 以最佳实践开始你的Django项目 micro:bit与事件驱动 为Scratch3.0设计的插件系统(上篇) OCR应用一例 近两年读过的一些好书 blockly开发之使用python驱动浏览器中的turtle(2) 牛顿新传 文学理论入门 逻辑的引擎 人生的意义 blockly开发之生成并运行js代码(1) blockly开发之hello world(0) micro:bit使用笔记 神器之Termux https://blog.just4fun.site/post/iot/micropython-notes/ Cozmo what is this Scratch的前世今生 下段旅程 我行在远方 爆裂 途中杂记 https://blog.just4fun.site/post/edx/open-edx-startup/ cozmo系列之入门 - 有性格且可编程的机器人 PaperWeekly开发笔记 创业二三事
Scratch3技术分析之Studio API(第8篇)
种瓜 · 2019-04-30 · via 夜行人

文章目录

本文是Scratch3.0技术分析之后端API系列的第8篇。

Studio是Scratch社区的重要构成部分。

Studio在概念上颇似项目收纳盒,用户可以将感兴趣的项目添加到收纳盒中。

Scratch团队还未完成Studio API的重构。目前要创建Studio,须从旧网页进入,url为:https://scratch.mit.edu/mystuff/#galleries, 从url可以看出Studiogalleries被scratch视为同义词。

如果你用过知乎或者掘金。会发现Studio收藏夹颇为相似。

之前在做paperweekly时,收藏夹部分参考了知乎掘金producthunt。各家大同小异,核心概念都是收纳盒/collections

产品视角: 不同之处

接下来说说Studio和知乎收藏夹的不同之处。

Scratch推崇4P(Projects, Passion, Peers, Play)原则, 它们将理念贯彻到产品中。

StudioProjects的收纳盒,用户兴趣各异,Passion各有不同。用户创建Studio一般从某种兴趣点出发。

至此,studios知乎收藏夹并没有什么差异。

我们可以看看Scratch社区里受欢迎的studios

由于社区里有兴趣相似的人,人们会对其他用户创建的收纳盒感兴趣,于是收纳盒应该支持关注/follow功能,在这点上,各家依旧没什么差别。

Peers的重视,是引起差异的原因。Scratch把社区用户视为潜在的协作者/Peers, 而知乎/掘金的收藏夹背后的逻辑则是把关注者视为围观群众

于是在产品定位和功能上就出现了根本差异。

在Scratch中,用户可以为Studio添加curators:

curators与Studio的创建者一样,可以一起维护这个Studio(本质上是个权限系统),curators拥有往Studio里增删项目的权利。

Studio甚至有个可选项Allow anyone to add projects: 将整个社区视为协作者。

一等公民

Studio和Porject一样,都是Scratch的一等公民,我们可以看到Studio和Porject类似,有自己的title、缩略图(标注1)、简介(标注2)和评论(标注3),此外还有活动日志(标注4)。

API分析

至此,我们基本上做完了产品层面的分析。

接下来我们开始API层面的分析。

创建Studio

让我们在https://scratch.mit.edu/mystuff/New Studio

细节如下:

创建完成后,重定向到 https://scratch.mit.edu/studios/8259659/, 该页面目前并未API化,应该是Django模版渲染的。

更新Studio信息

让我们将title更新为test2:

采用的是PUT方法,以表单方式提交数据

更新描述信息也相似。对应字段名为description

更新封面图片, 是用POST方式往https://scratch.mit.edu/site-api/galleries/all/8259659/提交图片,细节为:

提交之后,图片地址为://cdn2.scratch.mit.edu/get_image/gallery/8259659_200x118.png#1556595638951

可以看出带了时间戳,应该是出于缓存更新目的。

图片限制为: Maximum file size is 512 KB and less than 500x500 pixels.

往Studio里增删项目

这部分的功能已经迁移到Scratch新版网站中。

将项目添加到Studio中时,发生的细节为:

POST https://api.scratch.mit.edu/studios/8259659/project/302042626

response为{"actorId":18286387,"projectId":"302042626","datetimeCreated":"2019-04-30 03:45:31","studioId":"8259659"}

删除操作对应:DELETE https://api.scratch.mit.edu/studios/8259659/project/302042626, response为[]

关注(Follow) Studio

PUT https://scratch.mit.edu/site-api/users/bookmarkers/8259659/add/?usernames=wwj718

response:[{"featured_project_label_name": "Featured Project", "featured_project_data": null, "featured_project": null, "thumbnail_url": "//uploads.scratch.mit.edu/users/avatars/18286387.png", "user": {"username": "wwj718", "pk": 18286387}, "featured_project_label_id": null, "id": 17449452}]

邀请用户成为Studio的curators

PUT https://scratch.mit.edu/site-api/users/curators-in/8259659/invite_curator/?usernames=tonynsc

response为: {"status": "success", "data": {"user": "tonynsc"}}

Studio的评论

顶级评论

POST https://scratch.mit.edu/site-api/comments/gallery/8259659/add/

以表单形式提交:{"content":"test","parent_id":"","commentee_id":""}

回复评论

POST https://scratch.mit.edu/site-api/comments/gallery/8259659/add/

以表单形式提交:{"content":"test","parent_id":56665892,"commentee_id":18286387}

后记

目前Studio的API官方还在重构中,完成之后,我会同步更新这篇文章。

参考