wks: Move a few server functions to wks-util.