假设我有一个foo.js在 GitHub 存储库中命名的 JavaScript 脚本。我需要知道哪些站点(域)正在使用此脚本。因此,例如,如果一个网站www.example.com正在引用我的脚本......
<html>
<head>
<script src="https://myGitHubRepo/foo.js"></script>
</head>
etc...
</html>
Run Code Online (Sandbox Code Playgroud)
我想获取、跟踪或example.com列为域。更明确地说,我不想跟踪访问的实际用户,www.example.com也不想跟踪他们的 IP 或类似的东西,我只想跟踪或列出在 HTML 中引用我的脚本的站点(域)。那可能吗?
PS:一些假设的解决方案及其问题:
window.location.hostname脚本中的一个简单将得到我想要的,但它会在客户端得到它。我不知道是否可以将这些信息发回给我……实际上,我什至不知道这是否合法。我正在尝试使用 github graphql api、使用createCommitOnBranch突变创建一个新的提交。ExpectedHeadOid 应该使用什么值:“??????”?如何从 Graphql API 获得这样的价值?
到目前为止,这是我的尝试:
{
mutation m1 {
createCommitOnBranch(
input: {
branch:
{repositoryNameWithOwner: "some_repo/some_owner",
branchName: "main"
},
message: {headline: "headline!"},
fileChanges: {
additions: {path: "README.md", contents: "SGVsbG8gV29ybGQ="}
}
expectedHeadOid: "?????"
}
)
}
}
Run Code Online (Sandbox Code Playgroud)