Skip to content

Commit b334376

Browse files
committed
Add one more source
1 parent 3e1132d commit b334376

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

src/file_ref_map.dat

276 Bytes
Binary file not shown.

src/file_ref_map.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tools/FileRefExtractor/FileRefGenerator.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public static function generate(int|string $layer, string $inputSchema, string $
397397
$locations['document'][] = new CallOp(
398398
'users.getSavedMusicByID',
399399
[
400-
'id' => new GetInputUserOp(new Path([[$m, 'id']], true)),
400+
'id' => new GetInputUserOp(new Path([[$m, 'id']], true, 'user_id')),
401401
'documents' => new ArrayOp(
402402
new ConstructorOp(
403403
'inputDocument',
@@ -412,6 +412,23 @@ public static function generate(int|string $layer, string $inputSchema, string $
412412
'fileSourceSavedMusic'
413413
);
414414
}
415+
$locations['userFull'][] = new CallOp(
416+
'users.getSavedMusicByID',
417+
[
418+
'id' => new GetInputUserOp(new Path([['userFull', 'id']], customName: 'user_id')),
419+
'documents' => new ArrayOp(
420+
new ConstructorOp(
421+
'inputDocument',
422+
[
423+
'id' => new CopyOp([['userFull', 'saved_music', Path::FLAG_IF_ABSENT_ABORT], ['document', 'id']]),
424+
'access_hash' => new CopyOp([['userFull', 'saved_music', Path::FLAG_IF_ABSENT_ABORT], ['document', 'access_hash']]),
425+
'file_reference' => new PrimitiveLiteralOp('bytes', ''),
426+
],
427+
),
428+
),
429+
],
430+
'fileSourceSavedMusic'
431+
);
415432

416433
// Ignore these for now
417434
foreach (['payments.ResaleStarGifts', 'payments.StarGiftUpgradePreview', 'StarGift', 'StarGiftCollection', 'payments.StarGiftCollections'] as $type) {

tools/FileRefExtractor/Path.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function __construct(
3232
/** @var list<list{0: string, 1: string, 2?: int-mask-of<self::FLAG_*>|TypedOp}> */
3333
public array $path,
3434
public bool $isFromParent = false,
35+
private ?string $customName = null,
3536
) {
3637
foreach ($path as $k => $elem) {
3738
if (\count($elem) !== 2 && \count($elem) !== 3) {
@@ -74,14 +75,15 @@ public function normalize(array $stack, string $current, bool $ignoreFlag): ?sel
7475
if ($this->isFromParent) {
7576
// From parent
7677
if ($stack[0][0] === $this->path[0][0]) {
77-
return new static($new, true);
78+
return new self($new, true, $this->customName);
7879
}
7980
return null;
8081
}
8182
Assert::eq($this->path[0][0], $current);
8283
return new self(
8384
[...$stack, ...$new],
8485
false,
86+
$this->customName
8587
);
8688
}
8789

@@ -164,12 +166,7 @@ public function buildPath(TLContext $tl, string $extractor): string
164166
$flag = $tl->buildMode->storedFlags++;
165167
$type = "flags.$flag?$type";
166168
}
167-
$name = $tl->buildMode->curKey;
168-
if (\in_array($this->path[0][0], ['users.getSavedMusic', 'users.getSavedMusicByID'], true)
169-
&& $this->path[0][1] === 'id'
170-
) {
171-
$name = 'user_id';
172-
}
169+
$name = $this->customName ?? $tl->buildMode->curKey;
173170
Assert::notNull($name);
174171
if (isset($tl->buildMode->stored[$name])) {
175172
throw new AssertionError("Need custom name (already have $name) for ".json_encode($this->path));

0 commit comments

Comments
 (0)