-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c0f84d
commit fd9de40
Showing
8 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,6 @@ export default defineNitroConfig({ | |
privateKey: "", | ||
test: "", | ||
}, | ||
|
||
timing: true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/backend/server/routes/[orgOrAuthor]/[repo]/[ref]/[package].get.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { objectHash, sha256 } from "ohash"; | ||
import { WorkflowData } from "../../../../types"; | ||
|
||
type Params = Omit<WorkflowData, "sha"> & { | ||
package: string; | ||
}; | ||
|
||
export default eventHandler(async (event) => { | ||
const params = getRouterParams(event) as Params; | ||
const packagesBucket = usePackagesBucket(); | ||
|
||
const { package: packageName, ...hashPrefixMetadata } = params; | ||
const metadataHash = sha256(objectHash(hashPrefixMetadata)); | ||
const keys = await packagesBucket.getKeys(metadataHash) | ||
console.log(keys) | ||
// const packageKey = `${metadataHash}:${sha}:${packageName.split('.tgz')[0]}`; | ||
// if (!(await packagesBucket.hasItem(packageKey))) { | ||
// throw createError({ | ||
// status: 404, | ||
// }); | ||
// } | ||
// const buffer = await packagesBucket.getItemRaw<ArrayBuffer>(packageKey); | ||
|
||
// setResponseHeader(event, "content-type", "application/tar+gzip"); | ||
// // add caching | ||
// return new Response(buffer); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { WorkflowData } from "../types"; | ||
|
||
export function generateCommitPublishMessage( | ||
origin: string, | ||
packageName: string, | ||
workflowData: WorkflowData | ||
) { | ||
console.log(origin, workflowData) | ||
const url = new URL( | ||
`/${workflowData.orgOrAuthor}/${workflowData.repo}/${workflowData.ref}/${workflowData.sha}/${packageName}`, | ||
origin | ||
); | ||
return ` | ||
<table role="table"><tbody><tr><td><strong>Commit:</strong> </td><td> | ||
<code class="notranslate">${workflowData.sha}</code> | ||
</td></tr> | ||
<a href="${url}" rel="nofollow">${url}</a> | ||
</td></tr> | ||
</td></tr> | ||
</tbody></table> | ||
<code class="notranslate">npm i ${url}</code> | ||
`; | ||
} |