mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
stash: averages proto
This commit is contained in:
1 parent
474846e9c2
commit
f91dd1e2c0
5 files changed
+29
-6
No files matched your search
@@ -0,0 +1,16 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package blitzkit;
|
||||||
|
|
||||||
|
message Reviews {
|
||||||
|
map<uint32, Review> reviews = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Review {
|
||||||
|
repeated Video video = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Video {
|
||||||
|
string id = 1;
|
||||||
|
string author = 2;
|
||||||
|
}
|
||||||
+1
-1
@@ -229,7 +229,7 @@ async function postWork() {
|
|||||||
{
|
{
|
||||||
path: `averages/${latest}.pb`,
|
path: `averages/${latest}.pb`,
|
||||||
content: await encodeToBase64(
|
content: await encodeToBase64(
|
||||||
'blitzkit.AverageDefinitions',
|
'blitzkit/blitzkit.AverageDefinitions',
|
||||||
averageDefinitions,
|
averageDefinitions,
|
||||||
),
|
),
|
||||||
encoding: 'base64',
|
encoding: 'base64',
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const averageDefinitions = fetch(asset('averages/manifest.json'), {
|
|||||||
.then((response) => response.arrayBuffer())
|
.then((response) => response.arrayBuffer())
|
||||||
.then((buffer) =>
|
.then((buffer) =>
|
||||||
decode<AverageDefinitions>(
|
decode<AverageDefinitions>(
|
||||||
'blitzkit.AverageDefinitions',
|
'blitzkit/blitzkit.AverageDefinitions',
|
||||||
new Uint8Array(buffer),
|
new Uint8Array(buffer),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import { Root } from 'protobufjs';
|
|||||||
import { context } from '../blitzkit/context';
|
import { context } from '../blitzkit/context';
|
||||||
|
|
||||||
export async function lookup(proto: string) {
|
export async function lookup(proto: string) {
|
||||||
const name = proto.split('.')[0];
|
const [file, message] = proto.split('/')[0];
|
||||||
const root = await new Root().load(
|
const root = await new Root().load(
|
||||||
context === 'server'
|
context === 'server'
|
||||||
? `public/protos/${name}.proto`
|
? `public/protos/${file}.proto`
|
||||||
: `/protos/${name}.proto`,
|
: `/protos/${file}.proto`,
|
||||||
{ keepCase: true },
|
{ keepCase: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
return root.lookupType(proto);
|
return root.lookupType(message);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { youtubers } from './constants/youtubers';
|
||||||
|
import { decodeYouTubeId } from './core/youtube/decodeYouTubeId';
|
||||||
|
import { encodeYouTubeId } from './core/youtube/encodeYouTubeId';
|
||||||
|
|
||||||
|
youtubers.forEach((yt) => {
|
||||||
|
console.log(yt.id, decodeYouTubeId(encodeYouTubeId(yt.id)));
|
||||||
|
});
|
||||||
Reference in new issue
Block a user