Skip to content

feat: calculate registration date locally from user ID - #110

Merged
NextAlone merged 1 commit into
NextAlone:mainfrom
waifucon:local-profile-date-reg
Oct 4, 2026
Merged

NextAlone merged 1 commit into
NextAlone:mainfrom
waifucon:local-profile-date-reg

Conversation

@waifucon

@waifucon waifucon commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Description

dropped nicegram api call, using an local date calculator. the api call fails mostly for most new accs. it's instant the api had some delays.

Screenshot_20261002_150700_Nullgram

merged in nullgram too:
qwq233/Nullgram#397

Check List

  • I have tested the changes and verified that they work and don't break anything(as well as I can manage) or drop the support for previous versions.
  • My code follows the code style of this project
  • I have merged commits that are meaningless for follow-up work and confirmed that they will not cause damage to follow-up maintenance

@NextAlone NextAlone left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Dropping the Nicegram call is the right direction: it removes a third-party request that leaked every viewed user ID, a hardcoded API key, and the network dependency (plus the old LRU path that still re-requested after a cache hit).

Two things need fixing before merge, both about displayed results being wrong rather than merely approximate; see the inline comments on the "newer than" constant and on the non-monotonic table. The rest are suggestions.

Not anchorable inline:

  • [Suggestion] xyz/nextalone/nnngram/remote/BaseController.kt has no subclasses left after NicegramController is deleted (the translators use their own BaseTranslator), so it should be removed in this PR as well. The ktor dependency itself is still used by the translate module.
  • [Question] Where does id_date.json come from, what is its license, and how is it expected to be updated? The table ends at ID 8461412540, so it will go stale without a refresh process.

Reviewed statically (diff + a script over the table); not built or tested on a device.

Comment thread TMessagesProj/src/main/java/xyz/nextalone/nnngram/helpers/ProfileDateHelper.kt Outdated
"date": 1637590800
},
{
"id": 3318845111,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Must fix] The dates in this table are not monotonic: 41 of the 134 intervals have a later ID with an earlier date, so linear interpolation makes accounts with larger IDs look older. The worst one is right here: 2138472342 (2021-11-22) → 3318845111 (2021-04-10), a 226-day step back. This point and 4317845111 look like outliers. The final interval (8454563873 → 8461412540) also goes back 108 days.

Please clean the table into a monotonic sequence before shipping it (at minimum drop these two points and fix the tail).

Comment thread TMessagesProj/src/main/java/xyz/nextalone/nnngram/helpers/ProfileDateHelper.kt Outdated
Comment thread TMessagesProj/src/main/java/xyz/nextalone/nnngram/helpers/ProfileDateHelper.kt Outdated
private val json = Json { ignoreUnknownKeys = true }

private val profileDateDataList: List<ProfileDateData> by lazy {
runCatching {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[FYI] The first popup open reads and parses the asset on the main thread. The file is ~10 KB so the cost is small; mentioning it only in case the table grows.

@waifucon

waifucon commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author
* **[Question]** Where does `id_date.json` come from, what is its license, and how is it expected to be updated? The table ends at ID 8461412540, so it will go stale without a refresh process.

it comes from nagram:
https://github.com/NextAlone/Nagram/blob/f74e39f781862ca36971e35e227f4f5e66f7a84d/TMessagesProj/src/main/assets/id_date.json

@NextAlone

Copy link
Copy Markdown
Owner

Thanks for confirming the source of id_date.json.

One more thing worth checking before we drop the API entirely. The official Nicegram Android client now calls a versioned endpoint, POST v7/regdate (NicegramAppApi.kt), while our NicegramController still calls the unversioned /regdate. The failures you saw for new accounts may come from the old endpoint (or the key used with it) no longer being maintained, rather than from the service itself. I have not sent any requests myself, so this is only a hypothesis.

@waifucon could you test with a few new accounts (IDs above 8461412540, where the local table ends) and report:

  1. what the current /regdate call returns (status code and body),
  2. what v7/regdate returns for the same IDs — the official client may also send different headers, so please check its network setup,
  3. what this PR shows for those IDs.

This does not change the direction of the PR: the local table is still preferable for privacy and offline use. But the result tells us how far the local table lags behind the server for new accounts, which is relevant to the two must-fix comments above.

@waifucon
waifucon force-pushed the local-profile-date-reg branch from 87cc992 to 9c78f71 Compare October 4, 2026 12:14
@waifucon

waifucon commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author
1. what the current `/regdate` call returns (status code and body),

2. what `v7/regdate` returns for the same IDs — the official client may also send different headers, so please check its network setup,

i don't know their new api. but in exteraAPI it returns 2025-10

@exteraAuthBot regdate 8461412540

image

Co-authored-by: xtaodada <xtao@xtao.de>
@waifucon
waifucon force-pushed the local-profile-date-reg branch from 9c78f71 to 28ded77 Compare October 4, 2026 15:58
@waifucon

waifucon commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

[Suggestion] xyz/nextalone/nnngram/remote/BaseController.kt has no subclasses left after NicegramController is deleted

deleted basecontroller.kt

@waifucon

waifucon commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author
  1. what this PR shows for those IDs.
image

script used to get the data.
profile_date.py

@NextAlone
NextAlone merged commit 76ec080 into NextAlone:main Oct 4, 2026
1 check passed
NextAlone added a commit that referenced this pull request Oct 4, 2026
The table bundled in #110 was not monotonic: 41 of 134 intervals had a
larger ID mapped to an earlier date, so interpolation could show a newer
account as older. The tail was the visible case: IDs just below
8461412540 showed 2025-12 while larger ones showed "newer than 2025-08".

Drop the two synthetic anchors in the unused 2.1B-5.1B ID gap
(3318845111, 4317845111) and replace the remaining dates with their
least-squares non-decreasing fit (pool adjacent violators). 78 dates
move, by at most 82 days (median 20); no ID is added or renumbered.

Also take the lower bound from the table instead of a hardcoded
1000000, guard against a null currentLocale, and fix import order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@waifucon
waifucon deleted the local-profile-date-reg branch October 5, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants