当前位置: 首页 > news >正文

Chromium 中chrome.bookmarks扩展接口c++实现

一、扩展接口定义 chrome.bookmarks

使用 chrome.bookmarks API 创建、整理以及以其他方式操纵书签。另请参阅覆盖网页(可用于创建自定义“书签管理器”页面)。

更多参考chrome.bookmarks  |  API  |  Chrome for Developers (google.cn)

扩展可以请从 chrome-extension-samples 安装 bookmarks API 示例 存储库

二、扩展接口c++定义

chrome\common\extensions\api\bookmarks.json

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.[{"namespace": "bookmarks","description": "Use the <code>chrome.bookmarks</code> API to create, organize, and otherwise manipulate bookmarks. Also see <a href='override'>Override Pages</a>, which you can use to create a custom Bookmark Manager page.","properties": {"MAX_WRITE_OPERATIONS_PER_HOUR": {"value": 1000000,"deprecated": "Bookmark write operations are no longer limited by Chrome.","description": ""},"MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE": {"value": 1000000,"deprecated": "Bookmark write operations are no longer limited by Chrome.","description": ""}},"types": [{"id": "BookmarkTreeNodeUnmodifiable","type": "string","enum": ["managed"],"description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator. Omitted if the node can be modified by the user and the extension (default)."},{"id": "BookmarkTreeNode","type": "object","description": "A node (either a bookmark or a folder) in the bookmark tree.  Child nodes are ordered within their parent folder.","properties": {"id": {"type": "string","minimum": 0,"description": "The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted."},"parentId": {"type": "string","minimum": 0,"optional": true,"description": "The <code>id</code> of the parent folder.  Omitted for the root node."},"index": {"type": "integer","optional": true,"description": "The 0-based position of this node within its parent folder."},"url": {"type": "string","optional": true,"description": "The URL navigated to when a user clicks the bookmark. Omitted for folders."},"title": {"type": "string","description": "The text displayed for the node."},"dateAdded": {"type": "number","optional": true,"description": "When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>)."},"dateLastUsed": {"type": "number","optional": true,"description": "When this node was last opened, in milliseconds since the epoch. Not set for folders."},"dateGroupModified": {"type": "number","optional": true,"description": "When the contents of this folder last changed, in milliseconds since the epoch."},"unmodifiable": {"$ref": "BookmarkTreeNodeUnmodifiable","optional": true,"description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)."},"children": {"type": "array","optional": true,"items": { "$ref": "BookmarkTreeNode" },"description": "An ordered list of children of this node."}}},{"id": "CreateDetails","description": "Object passed to the create() function.","inline_doc": true,"type": "object","properties": {"parentId": {"type": "string","serialized_type": "int64","optional": true,"description": "Defaults to the Other Bookmarks folder."},"index": {"type": "integer","minimum": 0,"optional": true},"title": {"type": "string","optional": true},"url": {"type": "string","optional": true}}}],"functions": [{"name": "get","type": "function","description": "Retrieves the specified BookmarkTreeNode(s).","parameters": [{"name": "idOrIdList","description": "A single string-valued id, or an array of string-valued ids","choices": [{"type": "string","serialized_type": "int64"},{"type": "array","items": {"type": "string","serialized_type": "int64"},"minItems": 1}]}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "getChildren","type": "function","description": "Retrieves the children of the specified BookmarkTreeNode id.","parameters": [{"type": "string","serialized_type": "int64","name": "id"}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode"}}]}},{"name": "getRecent","type": "function","description": "Retrieves the recently added bookmarks.","parameters": [{"type": "integer","minimum": 1,"name": "numberOfItems","description": "The maximum number of items to return."}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "getTree","type": "function","description": "Retrieves the entire Bookmarks hierarchy.","parameters": [],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "getSubTree","type": "function","description": "Retrieves part of the Bookmarks hierarchy, starting at the specified node.","parameters": [{"type": "string","serialized_type": "int64","name": "id","description": "The ID of the root of the subtree to retrieve."}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "search","type": "function","description": "Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.","parameters": [{"name": "query","description": "Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all specified properties will be produced.","choices": [{"type": "string","description": "A string of words and quoted phrases that are matched against bookmark URLs and titles."},{"type": "object","description": "An object specifying properties and values to match when searching. Produces bookmarks matching all properties.","properties": {"query": {"type": "string","optional": true,"description": "A string of words and quoted phrases that are matched against bookmark URLs and titles."},"url": {"type": "string","optional": true,"description": "The URL of the bookmark; matches verbatim. Note that folders have no URL."},"title": {"type": "string","optional": true,"description": "The title of the bookmark; matches verbatim."}}}]}],"returns_async": {"name": "callback","parameters": [{"name": "results","type": "array","items": { "$ref": "BookmarkTreeNode" }}]}},{"name": "create","type": "function","description": "Creates a bookmark or folder under the specified parentId.  If url is NULL or missing, it will be a folder.","parameters": [{"$ref": "CreateDetails","name": "bookmark"}],"returns_async": {"name": "callback","optional": true,"parameters": [{"name": "result","$ref": "BookmarkTreeNode"}]}},{"name": "move","type": "function","description": "Moves the specified BookmarkTreeNode to the provided location.","parameters": [{"type": "string","serialized_type": "int64","name": "id"},{"type": "object","name": "destination","properties": {"parentId": {"type": "string","optional": true},"index": {"type": "integer","minimum": 0,"optional": true}}}],"returns_async": {"name": "callback","optional": true,"parameters": [{"name": "result","$ref": "BookmarkTreeNode"}]}},{"name": "update","type": "function","description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged.  <b>Note:</b> Currently, only 'title' and 'url' are supported.","parameters": [{"type": "string","serialized_type": "int64","name": "id"},{"type": "object","name": "changes","properties": {"title": {"type": "string","optional": true},"url": {"type": "string","optional": true}}}],"returns_async": {"name": "callback","optional": true,"parameters": [{"name": "result","$ref": "BookmarkTreeNode"}]}},{"name": "remove","type": "function","description": "Removes a bookmark or an empty bookmark folder.","parameters": [{"type": "string","serialized_type": "int64","name": "id"}],"returns_async": {"name": "callback","optional": true,"parameters": []}},{"name": "removeTree","type": "function","description": "Recursively removes a bookmark folder.","parameters": [{"type": "string","serialized_type": "int64","name": "id"}],"returns_async": {"name": "callback","optional": true,"parameters": []}}],"events": [{"name": "onCreated","type": "function","description": "Fired when a bookmark or folder is created.","parameters": [{"type": "string","name": "id"},{"$ref": "BookmarkTreeNode","name": "bookmark"}]},{"name": "onRemoved","type": "function","description": "Fired when a bookmark or folder is removed.  When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.","parameters": [{"type": "string","name": "id"},{"type": "object","name": "removeInfo","properties": {"parentId": { "type": "string" },"index": { "type": "integer" },"node": { "$ref": "BookmarkTreeNode" }}}]},{"name": "onChanged","type": "function","description": "Fired when a bookmark or folder changes.  <b>Note:</b> Currently, only title and url changes trigger this.","parameters": [{"type": "string","name": "id"},{"type": "object","name": "changeInfo","properties": {"title": { "type": "string" },"url": {"type": "string","optional": true}}}]},{"name": "onMoved","type": "function","description": "Fired when a bookmark or folder is moved to a different parent folder.","parameters": [{"type": "string","name": "id"},{"type": "object","name": "moveInfo","properties": {"parentId": { "type": "string" },"index": { "type": "integer" },"oldParentId": { "type": "string" },"oldIndex": { "type": "integer" }}}]},{"name": "onChildrenReordered","type": "function","description": "Fired when the children of a folder have changed their order due to the order being sorted in the UI.  This is not called as a result of a move().","parameters": [{"type": "string","name": "id"},{"type": "object","name": "reorderInfo","properties": {"childIds": {"type": "array","items": { "type": "string" }}}}]},{"name": "onImportBegan","type": "function","description": "Fired when a bookmark import session is begun.  Expensive observers should ignore onCreated updates until onImportEnded is fired.  Observers should still handle other notifications immediately.","parameters": []},{"name": "onImportEnded","type": "function","description": "Fired when a bookmark import session is ended.","parameters": []}]}
]

bookmarks.json生成对应文件:

out\Debug\gen\chrome\common\extensions\api\bookmarks.cc

out\Debug\gen\chrome\common\extensions\api\bookmarks.h

三、bookmarks函数实现:

chrome\browser\extensions\api\bookmarks\bookmarks_api.h

chrome\browser\extensions\api\bookmarks\bookmarks_api.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.#ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_#include <stdint.h>#include <memory>
#include <set>
#include <string>
#include <vector>#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "components/bookmarks/browser/base_bookmark_model_observer.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function.h"
#include "ui/shell_dialogs/select_file_dialog.h"class Profile;namespace base {
class FilePath;
}namespace bookmarks {
class BookmarkModel;
class ManagedBookmarkService;
}namespace content {
class BrowserContext;
}namespace extensions {namespace api {
namespace bookmarks {
struct CreateDetails;
}
}// Observes BookmarkModel and then routes the notifications as events to
// the extension system.
class BookmarkEventRouter : public bookmarks::BookmarkModelObserver {public:explicit BookmarkEventRouter(Profile* profile);BookmarkEventRouter(const BookmarkEventRouter&) = delete;BookmarkEventRouter& operator=(const BookmarkEventRouter&) = delete;~BookmarkEventRouter() override;// bookmarks::BookmarkModelObserver:void BookmarkModelLoaded(bookmarks::BookmarkModel* model,bool ids_reassigned) override;void BookmarkModelBeingDeleted(bookmarks::BookmarkModel* model) override;void BookmarkNodeMoved(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* old_parent,size_t old_index,const bookmarks::BookmarkNode* new_parent,size_t new_index) override;void BookmarkNodeAdded(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* parent,size_t index,bool added_by_user) override;void BookmarkNodeRemoved(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* parent,size_t old_index,const bookmarks::BookmarkNode* node,const std::set<GURL>& removed_urls) override;void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model,const std::set<GURL>& removed_urls) override;void BookmarkNodeChanged(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* node) override;void BookmarkNodeFaviconChanged(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* node) override;void BookmarkNodeChildrenReordered(bookmarks::BookmarkModel* model,const bookmarks::BookmarkNode* node) override;void ExtensiveBookmarkChangesBeginning(bookmarks::BookmarkModel* model) override;void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel* model) override;private:// Helper to actually dispatch an event to extension listeners.void DispatchEvent(events::HistogramValue histogram_value,const std::string& event_name,base::Value::List event_args);raw_ptr<content::BrowserContext> browser_context_;raw_ptr<bookmarks::BookmarkModel> model_;raw_ptr<bookmarks::ManagedBookmarkService> managed_;
};class BookmarksAPI : public BrowserContextKeyedAPI,public EventRouter::Observer {public:explicit BookmarksAPI(content::BrowserContext* context);~BookmarksAPI() override;// KeyedService implementation.void Shutdown() override;// BrowserContextKeyedAPI implementation.static BrowserContextKeyedAPIFactory<BookmarksAPI>* GetFactoryInstance();// EventRouter::Observer implementation.void OnListenerAdded(const EventListenerInfo& details) override;private:friend class BrowserContextKeyedAPIFactory<BookmarksAPI>;raw_ptr<content::BrowserContext> browser_context_;// BrowserContextKeyedAPI implementation.static const char* service_name() {return "BookmarksAPI";}static const bool kServiceIsNULLWhileTesting = true;// Created lazily upon OnListenerAdded.std::unique_ptr<BookmarkEventRouter> bookmark_event_router_;
};class BookmarksFunction : public ExtensionFunction,public bookmarks::BaseBookmarkModelObserver {public:// ExtensionFunction:ResponseAction Run() override;protected:~BookmarksFunction() override {}// Run semantic equivalent called when the bookmarks are ready.// Overrides can return nullptr to further delay responding (a.k.a.// RespondLater()).virtual ResponseValue RunOnReady() = 0;// Helper to get the BookmarkModel.bookmarks::BookmarkModel* GetBookmarkModel();// Helper to get the ManagedBookmarkService.bookmarks::ManagedBookmarkService* GetManagedBookmarkService();// Helper to get the bookmark node from a given string id.// If the given id can't be parsed or doesn't refer to a valid node, sets// |error| and returns nullptr.const bookmarks::BookmarkNode* GetBookmarkNodeFromId(const std::string& id_string,std::string* error);// Helper to create a bookmark node from a CreateDetails object. If a node// can't be created based on the given details, sets |error| and returns// nullptr.const bookmarks::BookmarkNode* CreateBookmarkNode(bookmarks::BookmarkModel* model,const api::bookmarks::CreateDetails& details,std::string* error);// Helper that checks if bookmark editing is enabled.bool EditBookmarksEnabled();// Helper that checks if |node| can be modified. Returns false if |node|// is nullptr, or a managed node, or the root node. In these cases the node// can't be edited, can't have new child nodes appended, and its direct// children can't be moved or reordered.bool CanBeModified(const bookmarks::BookmarkNode* node, std::string* error);Profile* GetProfile();private:// bookmarks::BaseBookmarkModelObserver:void BookmarkModelChanged() override;void BookmarkModelLoaded(bookmarks::BookmarkModel* model,bool ids_reassigned) override;// ExtensionFunction:void OnResponded() override;
};class BookmarksGetFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.get", BOOKMARKS_GET)protected:~BookmarksGetFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetChildrenFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getChildren", BOOKMARKS_GETCHILDREN)protected:~BookmarksGetChildrenFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetRecentFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getRecent", BOOKMARKS_GETRECENT)protected:~BookmarksGetRecentFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetTreeFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getTree", BOOKMARKS_GETTREE)protected:~BookmarksGetTreeFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksGetSubTreeFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.getSubTree", BOOKMARKS_GETSUBTREE)protected:~BookmarksGetSubTreeFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksSearchFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.search", BOOKMARKS_SEARCH)protected:~BookmarksSearchFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksRemoveFunctionBase : public BookmarksFunction {protected:~BookmarksRemoveFunctionBase() override {}virtual bool is_recursive() const = 0;// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksRemoveFunction : public BookmarksRemoveFunctionBase {public:DECLARE_EXTENSION_FUNCTION("bookmarks.remove", BOOKMARKS_REMOVE)protected:~BookmarksRemoveFunction() override {}// BookmarksRemoveFunctionBase:bool is_recursive() const override;
};class BookmarksRemoveTreeFunction : public BookmarksRemoveFunctionBase {public:DECLARE_EXTENSION_FUNCTION("bookmarks.removeTree", BOOKMARKS_REMOVETREE)protected:~BookmarksRemoveTreeFunction() override {}// BookmarksRemoveFunctionBase:bool is_recursive() const override;
};class BookmarksCreateFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.create", BOOKMARKS_CREATE)protected:~BookmarksCreateFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksMoveFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.move", BOOKMARKS_MOVE)protected:~BookmarksMoveFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};class BookmarksUpdateFunction : public BookmarksFunction {public:DECLARE_EXTENSION_FUNCTION("bookmarks.update", BOOKMARKS_UPDATE)protected:~BookmarksUpdateFunction() override {}// BookmarksFunction:ResponseValue RunOnReady() override;
};}  // namespace extensions#endif  // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_

总结:扩展通过chrome.bookmarks.get 等方法会进入此实现,需要拦截更改可以在此处修改。

相关文章:

Chromium 中chrome.bookmarks扩展接口c++实现

一、扩展接口定义 chrome.bookmarks 使用 chrome.bookmarks API 创建、整理以及以其他方式操纵书签。另请参阅覆盖网页&#xff08;可用于创建自定义“书签管理器”页面&#xff09;。 更多参考chrome.bookmarks | API | Chrome for Developers (google.cn) 扩展可以请从…...

编程思想:编程范式:响应式编程

文章目录 概述实现的设计模式举例总结概述 响应 响应一般指对于事件的响应,事件包括数据变化或其他事件 响应流程包括事件的发生,事件的传递,和事件的最终处理 事件在起点处发生,开始传递过程 传递过程,包括对事件的一系列处理,如事件封装的数据的类型转化,数据集合…...

Leetcode 颜色分类

这个算法采用了荷兰国旗问题&#xff08;Dutch National Flag Problem&#xff09;的解法思想&#xff0c;用三个指针将数组中的元素分为三个区域&#xff0c;并且对这些区域进行动态调整&#xff0c;达到排序的目的。 算法思想&#xff1a; 三个指针&#xff1a; low 指针表示…...

ssh连接阿里云长连接

如何让ssh保持连接&#xff1f; 有时候用ssh连接阿里云莫名奇妙断开了。怎么样才能保持连接呢&#xff1f; 修改系统的链接参数: &#xff08;1&#xff09;修改/etc/ssh/sshd_config文件&#xff0c;找到 ClientAliveInterval 0和ClientAliveCountMax 3并将注释符号&#x…...

栈的C实现

栈的C实现 栈简介栈的C实现1.栈结构体2.初始化栈3.栈的基本操作 栈简介 栈&#xff08;Stack&#xff09;是一种后进先出的数据结构&#xff0c;类似于一个垂直的容器。 栈的特点是后进先出&#xff0c;即最后入栈的元素最先出栈。栈可以用来解决递归问题、实现函数调用、以及…...

【MySQL】入门篇—数据库基础:关系数据库概念

一、背景与重要性 在当今数字化时代&#xff0c;数据的管理和存储变得尤为重要。无论是企业的客户信息、产品数据&#xff0c;还是社交媒体上的用户互动&#xff0c;数据都是推动业务和决策的核心。 关系数据库管理系统&#xff08;RDBMS&#xff09;是一种广泛使用的数据管理…...

不到千元的自动猫砂盆是智商税吗?这四大选购技巧不看就亏大了

虽然现在的人都说&#xff0c;猫砂盆等上班一天回来再清理也没有任何关系&#xff0c;但实际上在这一天里&#xff0c;猫咪的粪便已经在猫砂盆里滋生了很多无法察觉的细菌&#xff0c;久而久之就会影响猫咪的健康&#xff0c;导致尿闭&#xff0c;放了一天的便便臭味也让人无法…...

【图论】(二)图论基础与路径问题

图论基础与路径问题 图的构造邻接矩阵邻接表 所有可达路径邻接矩阵存储邻接表存储 字符串接龙有向图的完全可达性 图的构造 这里仅对图论路径问题中图的构造做整理总结归纳&#xff0c;具体详细相关概念请参考代码随想录上的整理总结&#xff1a; 图论理论基础深度优先搜索理…...

Git常用命令(持续更新中)

mkdir one 在当前目录下创建一个名为one的文件夹 cd one 进入one 文件夹 git init 初始化git 仓库 touch README.md 创建一个后缀为.md的新文件README.md git add README.md 将README.md添加到git暂存区 git add * . * 将所有文件添加到暂存区 git add "E:/t…...

什么是PLM系统?PLM系统对制造业起到哪些作用?三品PLM系统对汽车制造业意义

在当今竞争激烈的制造业环境中&#xff0c;企业面临着来自市场、技术、客户需求等多方面的挑战。为了应对这些挑战&#xff0c;许多制造企业纷纷引入产品生命周期管理PLM系统&#xff0c;以实现更高效、更灵活的产品全生命周期管理。PLM系统以其独特的优势&#xff0c;在优化产…...

Pr 视频效果:元数据和时间码刻录

视频效果/视频/元数据和时间码刻录 Video/Metadata & Timecode Burn-in 元数据和时间码刻录 Metadata & Timecode Burn-in效果是一种在视频画面上叠加显示剪辑元数据或时间码的工具。它允许在导出视频时&#xff0c;将需用的元数据信息直接刻录在画面上&#xff0c;方便…...

前端MD5加密

1.导入包 npm install --save ts-md5 2.使用方式 import { Md5 } from ts-md5;//md5加密后的密码 const md5PwdMd5.hashStr("123456").toUpperCase(); 3. Vue解析token中携带的数据 3.1 安装插件 npm install jwt-decode --save 3.2 引入 import {jwtDecode} fro…...

仿IOS桌面悬浮球(支持拖拽、自动吸附、自动改变透明度与点击、兼容PC端与移动端)

使用 pointerdown/pointermove/pointerup 实现仿IOS桌面悬浮球效果&#xff0c;支持拖拽、指定拖拽选对容器&#xff0c;指定拖拽安全区、自动吸附、自动改变透明度与点击&#xff0c;兼容PC端与移动端。 效果展示 https://code.juejin.cn/pen/7423757568268304421 代码实现 …...

智谱开放平台API调用解析

一、什么是智谱AI 智谱AI成立于2019年&#xff0c;由‌清华大学计算机系知识工程实验室的技术成果转化而来&#xff0c;是一家致力于人工智能技术研发和应用的公司。智谱致力于打造新一代认知智能大模型&#xff0c;专注于做大模型的中国创新。 二、智谱开放平台API调用 官方文…...

Linux中定时删除10天前的日志文件

例如&#xff1a;删除/data/log/目录下所有10天前的.log文件 find /data/log/ -type f -name "*.log" -mtime 10 -exec rm -f {} \;只查看要删除的文件有哪些&#xff0c;不真正删除文件 logfiles$(find /data/log/ -type f -name "*.log" -mtime 10) ec…...

贝壳Android面试题及参考答案

详细说Final关键字 在编程语言中,final关键字具有重要的作用。以下为你详细介绍final关键字: 一、final关键字的主要作用 修饰变量 当final修饰基本数据类型变量时,该变量的值一旦被初始化就不能再被改变。例如:final int num = 10;num = 20; // 这会导致编译错误当final修…...

基于vue的酒店预订管理系统(源码+定制+开发)

博主介绍&#xff1a; ✌我是阿龙&#xff0c;一名专注于Java技术领域的程序员&#xff0c;全网拥有10W粉丝。作为CSDN特邀作者、博客专家、新星计划导师&#xff0c;我在计算机毕业设计开发方面积累了丰富的经验。同时&#xff0c;我也是掘金、华为云、阿里云、InfoQ等平台…...

FreeRTOS——TCB任务控制块、任务句柄、任务栈详解

任务控制块结构体 任务控制块是 FreeRTOS 中用于描述和管理任务的数据结构&#xff0c;包含了任务的状态、优先级、堆栈等信息。 TCB_t的全称为Task Control Block&#xff0c;也就是任务控制块&#xff0c;这个结构体包含了一个任务所有的信息&#xff0c;它的定义以及相关变…...

【STM32单片机_(HAL库)】4-5-2【定时器TIM】【感应开关盖垃圾桶项目】HC-SR04超声波模块实验

1.硬件 STM32单片机最小系统HC-SR04超声波模块 2.软件 hcsr04驱动文件添加main.c程序 #include "sys.h" #include "delay.h" #include "led.h" #include "uart1.h" #include "hcsr04.h"int main(void) {HAL_Init(); …...

安全网络架构

网络安全解决方案是指通过一系列技术和措施来保护网络系统和数据的安全。它涉及多个方面&#xff0c;包括网络设备的防护、数据的加密和备份、安全策略的制定和执行等。以下是一些常见的网络安全解决方案&#xff1a; 防火墙&#xff1a;防火墙是一种硬件或软件设备&#xff0c…...

【Java学习笔记】Arrays类

Arrays 类 1. 导入包&#xff1a;import java.util.Arrays 2. 常用方法一览表 方法描述Arrays.toString()返回数组的字符串形式Arrays.sort()排序&#xff08;自然排序和定制排序&#xff09;Arrays.binarySearch()通过二分搜索法进行查找&#xff08;前提&#xff1a;数组是…...

uniapp微信小程序视频实时流+pc端预览方案

方案类型技术实现是否免费优点缺点适用场景延迟范围开发复杂度​WebSocket图片帧​定时拍照Base64传输✅ 完全免费无需服务器 纯前端实现高延迟高流量 帧率极低个人demo测试 超低频监控500ms-2s⭐⭐​RTMP推流​TRTC/即构SDK推流❌ 付费方案 &#xff08;部分有免费额度&#x…...

PL0语法,分析器实现!

简介 PL/0 是一种简单的编程语言,通常用于教学编译原理。它的语法结构清晰,功能包括常量定义、变量声明、过程(子程序)定义以及基本的控制结构(如条件语句和循环语句)。 PL/0 语法规范 PL/0 是一种教学用的小型编程语言,由 Niklaus Wirth 设计,用于展示编译原理的核…...

c#开发AI模型对话

AI模型 前面已经介绍了一般AI模型本地部署&#xff0c;直接调用现成的模型数据。这里主要讲述讲接口集成到我们自己的程序中使用方式。 微软提供了ML.NET来开发和使用AI模型&#xff0c;但是目前国内可能使用不多&#xff0c;至少实践例子很少看见。开发训练模型就不介绍了&am…...

七、数据库的完整性

七、数据库的完整性 主要内容 7.1 数据库的完整性概述 7.2 实体完整性 7.3 参照完整性 7.4 用户定义的完整性 7.5 触发器 7.6 SQL Server中数据库完整性的实现 7.7 小结 7.1 数据库的完整性概述 数据库完整性的含义 正确性 指数据的合法性 有效性 指数据是否属于所定…...

快刀集(1): 一刀斩断视频片头广告

一刀流&#xff1a;用一个简单脚本&#xff0c;秒杀视频片头广告&#xff0c;还你清爽观影体验。 1. 引子 作为一个爱生活、爱学习、爱收藏高清资源的老码农&#xff0c;平时写代码之余看看电影、补补片&#xff0c;是再正常不过的事。 电影嘛&#xff0c;要沉浸&#xff0c;…...

基于江科大stm32屏幕驱动,实现OLED多级菜单(动画效果),结构体链表实现(独创源码)

引言 在嵌入式系统中&#xff0c;用户界面的设计往往直接影响到用户体验。本文将以STM32微控制器和OLED显示屏为例&#xff0c;介绍如何实现一个多级菜单系统。该系统支持用户通过按键导航菜单&#xff0c;执行相应操作&#xff0c;并提供平滑的滚动动画效果。 本文设计了一个…...

aardio 自动识别验证码输入

技术尝试 上周在发学习日志时有网友提议“在网页上识别验证码”&#xff0c;于是尝试整合图像识别与网页自动化技术&#xff0c;完成了这套模拟登录流程。核心思路是&#xff1a;截图验证码→OCR识别→自动填充表单→提交并验证结果。 代码在这里 import soImage; import we…...

本地部署drawDB结合内网穿透技术实现数据库远程管控方案

文章目录 前言1. Windows本地部署DrawDB2. 安装Cpolar内网穿透3. 实现公网访问DrawDB4. 固定DrawDB公网地址 前言 在数字化浪潮席卷全球的背景下&#xff0c;数据治理能力正日益成为构建现代企业核心竞争力的关键因素。无论是全球500强企业的数据中枢系统&#xff0c;还是初创…...

【Java基础】​​向上转型(Upcasting)和向下转型(Downcasting)

在面向对象编程中&#xff0c;转型&#xff08;Casting&#xff09; 是指改变对象的引用类型&#xff0c;主要涉及 继承关系 和 多态。 向上转型&#xff08;Upcasting&#xff09; ⬆️ 定义 将 子类对象 赋值给 父类引用&#xff08;自动完成&#xff0c;无需强制转换&…...