Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-ntpc: remove app #6945

Merged
merged 1 commit into from
Mar 5, 2024
Merged

luci-app-ntpc: remove app #6945

merged 1 commit into from
Mar 5, 2024

Conversation

dannil
Copy link
Contributor

@dannil dannil commented Feb 28, 2024

As ntpclient package is dead, we can delete the app.

See #6945 (comment) and openwrt/packages#23569

Converted the app to use client-side JavaScript instead of Lua. The only real change to the previous implementation is I changed the Current system time field to match the format in Status -> System -> Local Time as I could not get the %c date format to work with the format function; if this is possible feel free to comment this. Package doesn't have a PKG_VERSION so by definition it hasn't been incremented.

Screenshot_9

  • This PR is not from my main or master branch 💩, but a separate branch ✅
  • Each commit has a valid ✒️ Signed-off-by: <my@email.address> row (via git commit --signoff)
  • Each commit and PR title has a valid 📝 <package name>: title first line subject for packages
  • Incremented 🆙 any PKG_VERSION in the Makefile
  • Tested on: (x86/generic, OpenWrt 23.05.2, Chrome and Firefox) ✅
  • ( Preferred ) Mention: @ the original code author for feedback
  • ( Preferred ) Screenshot or mp4 of changes:
  • ( Optional ) Closes: e.g. openwrt/luci#issue-number
  • ( Optional ) Depends on: e.g. openwrt/packages#pr-number in sister repo
  • Description: (describe the changes proposed in this PR)

@systemcrash
Copy link
Contributor

Great! I didn't even notice we had this app.

Could you hint the host name and port fields for when they're empty?

Maybe also add in the package description that this is a client.

@systemcrash
Copy link
Contributor

Also, would it be interesting to try and calculate the latency between browser and openwrt and attempt to compensate for the offset? Code golf perhaps 😎

Entirely optional.

@dannil
Copy link
Contributor Author

dannil commented Feb 28, 2024

Great! I didn't even notice we had this app.

Could you hint the host name and port fields for when they're empty?

Maybe also add in the package description that this is a client.

That sounds like good additions, I will add that.

Also, would it be interesting to try and calculate the latency between browser and openwrt and attempt to compensate for the offset? Code golf perhaps 😎

Entirely optional.

Haha, I can give it a shot, but I don't promise anything, if anything I can experiment with it and open a PR later on for it.

@dannil
Copy link
Contributor Author

dannil commented Feb 28, 2024

@systemcrash I've updated the code with your suggestions.

@systemcrash
Copy link
Contributor

One question: the local Date() clock monotonically increases with time?

@dannil
Copy link
Contributor Author

dannil commented Mar 1, 2024

One question: the local Date() clock monotonically increases with time?

No, once you enter the app, the clock fetches the current timestamp and displays that, with no auto-refresh or anything fancy like that. That is also how the previous implementation in Lua behaved so I didn't change that, but it wouldn't be hard to implement this if we wanted, like how the overview page auto-refreshes the Local Time every 5 seconds.

@systemcrash
Copy link
Contributor

OK - I'm trying to reconcile what System -> Time Sync does not do. With such similar data and function, perhaps the two could be merged if they are not already the same.

@dannil
Copy link
Contributor Author

dannil commented Mar 1, 2024

OK - I'm trying to reconcile what System -> Time Sync does not do. With such similar data and function, perhaps the two could be merged if they are not already the same.

I think the biggest difference is that System -> Time Sync is built to support ntpd while this app was built to support ntpclient, so consolidating them would be quite a challenge of the top of my head as we would need to adapt luci-mod-system to support configuring multiple NTP daemons.

We could of course think of adding UI options of features that ntpclient has that ntpd doesn't but that it currently supports but I think that's entirely separate PR:s to do that work.

systemcrash
systemcrash previously approved these changes Mar 1, 2024
@systemcrash
Copy link
Contributor

So I just had a look at the ntpclient package. It points to http://doolittle.icarus.com/ntpclient which is dead.

Unless a suitable replacement is found, the package can be removed. The existing system can make calls to other ntpd sources to synchronise, which is basically what ntpclient does, right?

@dannil
Copy link
Contributor Author

dannil commented Mar 1, 2024

Nice find, I didn't even know that the project was dead. I'm not opposed to just deleting the whole package, I don't know what the processes are regarding that if there's some users that are currently relying on it?

The existing system can make calls to other ntpd sources to synchronise, which is basically what ntpclient does, right?

I'm not entirely sure but yes I think so. I created this PR purely to port luci-app-ntpc to JavaScript and what I did to verify was to check that the UCI config values that the Lua implementation wrote to was still updated correctly after the conversion.

$ uci show ntpclient
ntpclient.@ntpserver[0]=ntpserver
ntpclient.@ntpserver[0].hostname='0.openwrt.pool.ntp.org'
ntpclient.@ntpserver[0].port='123'
ntpclient.@ntpserver[1]=ntpserver
ntpclient.@ntpserver[1].hostname='1.openwrt.pool.ntp.org'
ntpclient.@ntpserver[1].port='123'
ntpclient.@ntpserver[2]=ntpserver
ntpclient.@ntpserver[2].hostname='2.openwrt.pool.ntp.org'
ntpclient.@ntpserver[2].port='123'
ntpclient.@ntpserver[3]=ntpserver
ntpclient.@ntpserver[3].hostname='3.openwrt.pool.ntp.org'
ntpclient.@ntpserver[3].port='123'
ntpclient.@ntpdrift[0]=ntpdrift
ntpclient.@ntpdrift[0].freq='0'
ntpclient.@ntpclient[0]=ntpclient
ntpclient.@ntpclient[0].interval='600'

@systemcrash
Copy link
Contributor

Nice find, I didn't even know that the project was dead. I'm not opposed to just deleting the whole package, I don't know what the processes are regarding that if there's some users that are currently relying on it?

Not sure how anyone can rely on a package which has no sources any longer. We can check back in a few days and see whether the host comes back.

I've made a PR otherwise here openwrt/packages#23569

@systemcrash systemcrash marked this pull request as draft March 1, 2024 21:23
@systemcrash systemcrash dismissed their stale review March 1, 2024 21:24

because

Copy link
Contributor

@stokito stokito left a comment

Choose a reason for hiding this comment

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

Nice work.
Please become a maintainer and add PKG_MAINTAINER

#: applications/luci-app-ntpc/luasrc/model/cbi/ntpc/ntpcmini.lua:6
msgid "Synchronizes the system time"
#: applications/luci-app-ntpc/htdocs/luci-static/resources/view/ntpc.js:24
msgid "Synchronizes the system time."
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the dot at end and this will keep a translation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


return view.extend({
load: function () {
return Promise.all([
Copy link
Contributor

Choose a reason for hiding this comment

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

Here you have only one promise so you can remove the Promise.all()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

render: function (data) {
var system_info = data[0];

var m, s1, time, interval, count, freq, s2, s3, hostname, port;
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually for section and option separate vars aren't created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


m = new form.Map('ntpclient', _('Time Synchronisation'), _('Synchronizes the system time.'));

s1 = m.section(form.TypedSection, 'ntpclient', _('General'));
Copy link
Contributor

Choose a reason for hiding this comment

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

So instead of s1 use:
s = m.section(form.TypedSection, 'ntpclient', _('General'));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

);
}

time = s1.option(form.DummyValue, '_time', _('Current system time'));
Copy link
Contributor

Choose a reason for hiding this comment

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

o = s.option(form.DummyValue, '_time', _('Current system time'));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@dannil
Copy link
Contributor Author

dannil commented Mar 3, 2024

Nice work. Please become a maintainer and add PKG_MAINTAINER

@systemcrash has a PR open in openwrt/packages#23569 to drop support for ntpclient since the sources seems to be dead (#6945 (comment)), so we may drop the app entirely instead.

If the decision is made to drop it, I can just close this PR and create a new one which drops the app. Otherwise I can add myself as a maintainer.

@stokito
Copy link
Contributor

stokito commented Mar 3, 2024

Interesting, I found that Luci already has NTP config in a System page if the sysntpd from BusyBox was enabled during a compilation.

luci NTP servers configuration

Its settings are stored to /etc/config/system:

config timeserver 'ntp'
    option enabled '1'
    option enable_server '0'
    list server '0.openwrt.pool.ntp.org'
    list server '1.openwrt.pool.ntp.org'

So yes, probably the feature may be removed.
Still it may be used in some old firmware of some vendors. So maybe the app will be useful for them.
When removing the app please tag the issue so they may find the PR and maybe use it once last time.

@hnyman
Copy link
Contributor

hnyman commented Mar 4, 2024

Busybox ntp has been the default server and client at least for a decade, and there has been config for that in System settings (luci-mod-system) all the time.

So, I really wonder if somebody is actively using this. This app has not been modified for some 10 years...
@dannil
you got interested in this. do you actually use it?

@dannil
Copy link
Contributor Author

dannil commented Mar 4, 2024

Busybox ntp has been the default server and client at least for a decade, and there has been config for that in System settings (luci-mod-system) all the time.

So, I really wonder if somebody is actively using this. This app has not been modified for some 10 years... @dannil you got interested in this. do you actually use it?

No I don't use it, I basically picked this as a "test platform" to get into developing in LuCI (the whole "we don't develop apps in Lua anymore" seemed a good issue to start with). I'm fine to drop support for the whole app it if we conclude that the ntp functionality in System settings fulfill the same goals.

@systemcrash
Copy link
Contributor

OK, we can axe ntpc.

@dannil please truncate this PR just to removal.

As ntpclient package is dead, we can delete the app.

Signed-off-by: Daniel Nilsson <daniel.nilsson94@outlook.com>
@dannil dannil changed the title luci-app-ntpc: convert to JavaScript luci-app-ntpc: remove app Mar 5, 2024
@dannil
Copy link
Contributor Author

dannil commented Mar 5, 2024

PR and commit is updated to remove the app instead.

@dannil dannil marked this pull request as ready for review March 5, 2024 16:30
@hnyman hnyman merged commit 452e813 into openwrt:master Mar 5, 2024
5 checks passed
@BKPepe
Copy link
Member

BKPepe commented Mar 6, 2024

It needs to be backported to OpenWrt 23.05.

BKPepe referenced this pull request in openwrt/packages Mar 6, 2024
ntp sources are dead and gone. The most important functionality is now
provided by ntpd.

Signed-off-by: Paul Donald <newtwen@gmail.com>
(cherry picked from commit 2cd10d8)
@dannil dannil deleted the ntpc-to-js branch March 6, 2024 20:14
@dannil
Copy link
Contributor Author

dannil commented Mar 6, 2024

I've opened #6970 to backport it.

systemcrash pushed a commit that referenced this pull request Mar 6, 2024
luci-app-ntpc: remove app
(cherry picked from commit 452e813)
systemcrash pushed a commit that referenced this pull request Mar 7, 2024
luci-app-ntpc: remove app
(cherry picked from commit 452e813)
db260179 pushed a commit to db260179/openwrt-luci that referenced this pull request Mar 16, 2024
luci-app-ntpc: remove app
(cherry picked from commit 452e813)
db260179 pushed a commit to db260179/openwrt-luci that referenced this pull request Mar 22, 2024
luci-app-ntpc: remove app
(cherry picked from commit 452e813)
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.

5 participants