There is no way to determine with certainty whether it is safe and proper.
Commercial fixtures that are UL approved are inspected and tested to ensure safe, and they are evaluated against the Code to determine proper.
A home brewed fixture may be fine, and may even be far beyond the minimum standards for safe, but without an objective review, there is no way to determine.
Generally fixtures need to be affixed to the box using the built in attachment points, and wires need to be contained within the box or within the fixture itself (that has been evaluated to ensure safety). There also needs to be no way that live wires are accessible or that exposed metal parts are energized.
In general, the Code does not permit a fixture to be used in a manner other than that for which it was designed. By changing the electrical connection mechanism, you are not using it in the manner for which it was designed. So you are probably outside Code.
That does not mean it will not work, or that it is not safe, only that no one can give you assurance from a distance that it is safe and proper.